Instead of using
__declspec(dllimport)
and
__declspec(dllexport)
in header file, which would (most probably) be common for both DLL and the EXE (or another DLL); you can define a common macro:
#ifdef DLL_PROJECT
#define IMPORT_EXPORT __declspec(dllexport)
#else
#define IMPORT_EXPORT __declspec(dllimport)
#endif
For the you need to define
DLL_PROJECT
in DLL project. You should name this macro to something meaningful, like
MP3CODEC_DLL
, so that it doesn't clash with some other projects/header files:
#ifdef MP3CODEC_DLL
#define CODEC_IMPORT_EXPORT __declspec(dllexport)
#else
#define CODEC_IMPORT_EXPORT __declspec(dllimport)
#endif</pre>
And then use
CODEC_IMPORT_EXPORT
in your header file.