DLL exports
Hi,
I want to access a class inside a DLL, but also use it within the DLL. So I have to use "__declspec(dllexport)", no? But VC++ says me (if I try that): error LNK2005 "class ..." already defined in "...". I can avoid this if I use "extern" in the .h file (in which the class is used). But then I can''t reach the class outside of the DLL.
Question: How do I avoid LNK2005 but also can use the class in my application ("extern __declspec(dllexport)" doesn''t work!)?
Darkening
you should specify __declspec(dllexport) on the class (in the header file) when building the dll, and specify __declspec(dllimport) in the header when using the dll. Easiest is to use a #define.
ex.
And then define BUILDING_DLL only when you are building the DLL.
Edited by - Dactylos on June 27, 2001 5:57:23 PM
ex.
|
And then define BUILDING_DLL only when you are building the DLL.
Edited by - Dactylos on June 27, 2001 5:57:23 PM
Actually it works, but now I get the compiler warning C4273 (something like "Inconsistent DLL binding..." (I don''t know the English text, because I have a German version)). What does THAT mean! VC++ does a dllEXport if I write dllIMport. If I write dllEXport, it gives me nothing but errors. That''s really amazing!
Darkening
Darkening
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement