Using DLLs

I am trying to use functions defined in AVICap32.dll. I am using VC++ 6.0 and programming using MFC. How do I link the DLL so that I can call functions implicitly. I have tried to go to Projec - Settings - Link and specify the path and dll there but when I try to compile it says it cannot do it. Also once it is linked how can I call functions from it?
Thank you
Who is Participating?
jkrConnect With a Mentor Commented:
You'll have to add avicap32.lib to your project in order to use its functions, not the DLL itself.

But to use the functions from the DLL, you'll have to include the header file that declares the functions which are exported from the DLL in order to be able to use them.

Please ask if you need more information...
You must have the .lib file for the DLL, do you?  if so add the lib file to the project.  (just right click on the project in the workspace window and select the "add files to project" option.  Then add the .lib file.
SashoAuthor Commented:
How do I obtain a copy of the LIB file. The DLL is installed on the system with the OS.  Thanks
When you're using MS compilers, you can do that:

To create this lib:

Step.1 - Get the list of functions. 'dumpbin.exe /exports thedll.dll' will display the exports along with any lingering decorations.

Step.2 - Make a .def file for the dll. It should look like:


Step.3 - use the MSVC LIB.EXE command line tool to make a .lib using only
the .def

C:\Some Path>lib /def:mydef.def

Then, create a header file for the functions based on the documentation...

The header file will then contain lines like:

EXTERN_C INT WINAPI ADllFuncThatReturnsAnInt(INT nParam1,VOID* pvPAram2);

"WINAPI" is a neater Win32 way of saying "__stdcall". The "EXTERN_C" ensures
that all C++ decoration is removed from generated function names.

Include the header file in any c/cpp files that want to call the functions
(duh!). Add the .lib to the project.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.