I have a shared library that uses CMake as a build system. It compiles fine on Linux machines with GCC. Now I am trying to compile windows. MSVC will not export characters until the specified. I know about __declspec(dllexport) . But the example provided on the CMake wiki is confusing. Please consider the following code.
#if defined (_WIN32) #if defined(MyLibrary_EXPORTS) #define MYLIB_EXPORT __declspec(dllexport) #else #define MYLIB_EXPORT __declspec(dllimport) #endif #else #define MYLIB_EXPORT #endif
I understand __declspec(dllexport) , but I wonder why __declspec(dllimport) ? Also how can I use this? MYLIB_EXPORT void function() this look like MYLIB_EXPORT void function() ?
I have a C function called foo() . This internally uses several static functions. When exporting, do I need to export static functions as well? Or is it enough to export only the input functions that are part of the API?
Any help would be greatly appreciated.
source share