Macro for dllexport/dllimport switch
c++, visual-c++, visual-studio-2010
Solution
Best place to define `COMPILING_DLL=1` is command line of compiler. If you use Visual Studio IDE then it is in Project properties ... C/C++ ... Preprocessor ... Preprocessor Definitions.
`__declspec(dllimport)` is Microsoft specific extension to C++. Microsoft has excellent online documentation.
Problem
``` #if COMPILING_DLL #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT __declspec(dllimport) #endif ``` How / where do I define `COMPILING_DLL` ? Seen here: what does __declspec(dllimport) really mean? Sounds like I can't use load-time dynamic linking at all if I can't use the same header?