I've used the DECLARE_SERIAL and IMPLEMENT_SERIAL macros in some classes I'd now like to export from a DLL. But I'm having some trouble linking. There were a bunch of warningsC4273, C4251, and C4275, to be specific. I've #pragma'd them out for the time being. But I'm getting another error now:
C:\USERS\DEFAULT\src\bbsched\lib\src\schevent.cpp(83) : error C2491: 'CBWeeklyEvent::classCBWeeklyEvent': definition of dllimport static data member not allowed
The offending line is:
IMPLEMENT_SERIAL(CBWeeklyEvent, CObject, SERIALIZE_VERSION);
I'm not sure what I can do about this. Clearly, there must be some workaround, otherwise MFC couldn't use IMPLEMENT_SERIAL in any of its exported classes. What's the answer?
Frustrated Linker
I assume that you are using an extension dialog. I had this problem with an extension. I fixed it by changing the _AFXDLL preprocessor flag to _AFXEXT.
C4275 warnings are to be expected. They are just telling you that a Microsoft Foundation Class Library (MFC) base class you are using isn't exported from the dynamic-link library (DLL). However, this doesn't matter because the MFC classes are in the shared DLL. It would matter if the base class were your own class.