0

I am new to using .dll's in c++ and am trying to load a .dll file in my code. The dll is "Extremely Simple Capture API" or escapi.dll . The site I got the .dll from did not include a library file with the .dll, and considering I don't know how to load a .dll with the library file, trying to do it without it is doubly hard. i just want to take a snapshot with the webcam on the computer and display the image on the screen.

The functions I use from the .dll to do this are:

int setupESCAPI(int height, int width);
int initCapture(SimpleCapParams *capture);
void doCapture();
void isCaptureDone();
void deinitCapture();

If anyone can give me easy instructions on how to include this .dll without a .lib file, I would appreciate it. Thanks.

Dan

Danny Ahdoot
  • 19
  • 1
  • 9
  • Do you know what any functions are called within the DLL? – Grantly Nov 17 '14 at 20:06
  • I added the functions declarations that are used, and yes, I have the .h file. – Danny Ahdoot Nov 17 '14 at 20:26
  • Is the SimpleCapParams also in the H file? If so - then you will need to reproduce this in C++ too... Post the definition if you have it, so someone (or myself) can answer in full – Grantly Nov 17 '14 at 20:28

2 Answers2

2

I looked at the download for ESCAPI and it has all you need. Just include escapi.cpp in your project and call setupESCAPI. setupESCAPI loads the DLL for you. You will also need to put the DLL in the same folder as your executable.

Jim Rhodes
  • 5,021
  • 4
  • 25
  • 38
  • Jim,Thank you. Thank worked perfectly. I didn't realize I needed to include the .cpp file in the project. But now I'm havinng technical difficulies with the functionality of the .dll. Different issue. Thanks everyone for the help. – Danny Ahdoot Nov 17 '14 at 20:53
0

An elegant way to link to DLLs is dynamically. Then no LIB file is required, and you can have nicer error management. This article is good:

http://msdn.microsoft.com/en-us/library/ms810279.aspx

What you basically do is create prototypes in C++ of the functions you want to call in the DLL. (Not exactly prototypes, but you can think of them the same way)

Then call LoadLibrary to load the DLL, and GetProcAddress to link your prototype to each function in the DLL.

Then you can call your 'functions' (prototypes) - and they will be attached to the functions in the DLL

Grantly
  • 2,546
  • 2
  • 21
  • 31