uetoyo
uetoyo

Reputation: 329

How to link .dll library with the C++ VS project?

I want to use existing library (only .dll, not .lib) with the corresponding header file in my C++ project. I changed these settings: Project > Config. Settings > C/C++ > General > Additional Include Directories > Path\to\my\DLL, but it seems that this is not the right way. I also tried change some linker settings. I use new Visual Studio Express. Thanks.

Upvotes: 0

Views: 599

Answers (2)

Edward Clements
Edward Clements

Reputation: 5152

According to this MSDN article (it is quite old, but the steps should still work), you need to

a) Use DUMPBIN /EXPORTS <.DLL file name> to obtain the list of exported symbols for the .DLL [you should be able to run DumpBin from your Visual Studio command prompt]

b) Create a .DEF file that contains an EXPORTS section with the names of the functions; see here for an explanation of the .def file layout; this link has an example of how a .def file looks like

c) Use LIB /DEF:<.DEF file name> to generate the .lib file

Upvotes: 1

Dennis
Dennis

Reputation: 3741

You need a reference to the .lib file corresponding to the DLL. The Lib file is basically a set of symbols that allows the linker to resolve the dependencies. It kinda stands in place of the DLL for the linker.

Upvotes: 1

Related Questions