Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using DLLs

Posted on 1999-07-01
4
Medium Priority
?
261 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:Sasho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 1198945
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...
0
 
LVL 22

Expert Comment

by:nietod
ID: 1198946
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.
0
 
LVL 3

Author Comment

by:Sasho
ID: 1198947
How do I obtain a copy of the LIB file. The DLL is installed on the system with the OS.  Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 1198948
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:

EXPORTS
DllFunction1
DllFunction2
DllFunction3

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.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question