tags:

views:

148

answers:

1
A: 

The problem is in the AFX_EXT_CLASS macro.

#ifdef _AFXEXT
    #define AFX_EXT_CLASS       __declspec(dllexport)
#else
    #define AFX_EXT_CLASS       __declspec(dllimport)
#endif

Extension dll defines _AFXEXT and your class is exported, and main app (or a regular dll) doesn't define it so it's imported. But your second extension dll also defines _AFXEXT and your class declaration uses dllimport instead of dllexport and you get a linker error. The solution is to create your own macro for both dlls and use them instead of AFX_EXT_CLASS:

#ifdef EXTENSION_ONE
    #define EXT_CLASS_ONE       __declspec(dllexport)
#else
    #define EXT_CLASS_ONE       __declspec(dllimport)
#endif

Create EXTENSION_TWO and EXT_CLASS_TWO for your second dll. Define EXTENSION_ONE only in your first extension dll project, and EXTENSION_TWO only in your second extension dll project.

Nikola Smiljanić