Weird export macro behaviour.
Hi, I've got a weird problem here. Well, I'm using a library and I use the usual macro definition:
Code:
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
# ifdef LIBRARY_EXPORT
# define DLL_EXPORT __declspec(dllexport)
# else
# define DLL_EXPORT __declspec(dllimport)
# endif
#else
# ifdef LIBRARY_EXPORT
# define DLL_EXPORT __attribute__ ((visibility("default")))
# else
# define DLL_EXPORT
# endif
#endif
for exporting. I put the LIBRARY_EXPORT in the pre-processor so it should've chosen the "# define DLL_EXPORT __declspec(dllexport)" line, right? But turns out it chooses the "# define DLL_EXPORT __declspec(dllimport)" or the else line. So I tried using some kind of hack like this:
Code:
#ifndef LIBRARY_EXPORT
#define LIBRARY_EXPORT
#endif
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
...
And now the library can't be built at all. There are tons of LNK2001 and LNK2019 all over. Why does this happen? Please help because I'm still not that experienced using / developling with third party libraries.