Click to See Complete Forum and Search --> : using dll in c++


amir_civil
December 6th, 2006, 12:04 PM
hi every body
i need use mydll.dll
how to add dll to c++ project and use ?
thanks

ahoodin
December 6th, 2006, 01:11 PM
1. Take .lib from dll project directory move to app project directory.

2. Add .lib to linker page in libraries. YES the dll has a .lib to implicitly link the DLL.

3. Add the exports header file to the application project. It should contain all your functions and classes. It should have this format:

#ifdef YOUR_EXPORTS//this should be defined in the dll project
#define LINKDLL __declspec (dllexport)
#else
#define LINKDLL __declspec (dllimport)
#endif
//WAS ___declspec now stdcall
LINKDLL void your_functions(char *);

If you want to explicitly and dynamically load your dll check out loadlibrary().

HTH,

sreehari
December 7th, 2006, 02:09 AM
Creating and using DLL's (http://www.flipcode.com/articles/article_creatingdlls.shtml)