I have multiple classes in multiple dll’s and each dll’s may include other.
I use the following macro in order to specify the __declspec parameter for all the headers of my dll’s :
#ifdef DLL_UTIL_A
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
Let’s say dllA is including dllB.
The thing is, when I include dllB’s header file in dllA, the macro DLLEXPORT is redefined to import the classes from dllB’s header file. When the pre-processor returns to dllA to continue it’s parsing, it has an updated DLLEXPORT with an updated unwanted value.
Should I use different defines for each dll’s (ex. replace DLLEXPORT by DLLEXPORT_DLL_A) or is there a clean way to get the DLLEXPORT‘s old value back when returning in dllA?
You need to use a different macro name for DLLEXPORT for both DLLs.