#ifdef _MSC_VER #define EXPORT __declspec(dllexport) #else #define EXPORT #endif EXPORT const char * foo2() { return "42"; }