I make .dll and .lib Dll works well, but I cannot use .lib?
I make .dll library in whitch is one exported class and some functions (interface for non object compilers)
#ifdef DRIVER_EXPORTS
#define DRIVER_API __declspec(dllexport)
#else
#define DRIVER_API __declspec(dllimport)
#endif
class DRIVER_API CDriver ...
extern "C" DRIVER_API int __stdcall fReadRequest(HANDLE hDriver,...);
Because I use this library in another .dll library (2 .dll files- this work well) I want make .lib to link only one .dll file.
I make .lib (another project vith same code, or rewrite .dsp file)
I add .lib to Project - Setings - Link - Object/library modules:, but linker error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CDriver::CDriver(void)" (__imp_??0CDriver@@QAE@XZ)!!!
Where is problem :confused:
Please help!!!
[849 byte] By [
ondrak] at [2007-11-18 0:00:24]

# 1 Re: I make .dll and .lib Dll works well, but I cannot use .lib?
Because I use this library in another .dll library (2 .dll files- this work well) I want make .lib to link only one .dll file.
I make .lib (another project vith same code, or rewrite .dsp file)
What exactly are you trying to do?
omri at 2007-11-10 8:47:20 >

# 2 Re: I make .dll and .lib Dll works well, but I cannot use .lib?
Sorry for my terible english.
I make project to get dynamic link library (.dll) whitch is used as "driver"
After it I make another project for another .dll whitch use same hardware but is specialised for one system. Logicaly I use finished .dll. To link class from first .dll sufficient add dependenci betwen project. Program using both 2 .dll work without problem.
But better is use only one file!
After it I can both .dll link to one. Solution is make static link library (.lib)
I make .lib (I try 2 ways - make new project with same source code, or add aditional configurations (need edit .dsp file))
After compiling I remove dependenci to first .dll and add .lib to list of libraries. But compiler can'not find exported class
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CDriver::CDriver(void)" (__imp_??0CDriver@@QAE@XZ)
I don't know why? Code is well - .dll is OK.
In lib. I can find string "??0CDriver@@QAE@XZ" - class is exported too.
Linking static library is not problem!? - :cool: - maybe
Where is a problem?? :confused:
ondrak at 2007-11-10 8:48:20 >

# 3 Re: I make .dll and .lib Dll works well, but I cannot use .lib?
It's happen because you had still been using the symbol DRIVER_EXPORTS with __declspec().
You can use the _WINDLL or _USRDLL symbols defined for DLL project and not defined for LIB project.
#if defined(_WINDLL) || defined(_USRDLL)
#ifdef DRIVER_EXPORTS
#define DRIVER_API __declspec(dllexport)
#else
#define DRIVER_API __declspec(dllimport)
#endif
#else
#define DRIVER_API
#endif
Vi2 at 2007-11-10 8:49:25 >
