STL in DLL's
-
I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net
-
I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net
-
I have a DLL class that I am exporting, // Observer Class class APA_API CStateObserver { ... } class APA_API CStateMachine { public: void PushObserver(CStateObserver * inpObserver); private: std::deque m_dqObservers; } APA_API is the define that resolves to the correct __dellspec(lalalalalal) etc... I get this compiler warning message, warning C4251: 'm_dqObservers' : class 'std::deque >' needs to have dll-interface to be used by clients of class 'CStateMac I have 'Warnings as Errors' set so this warning is a real problem. What are my options? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net
disable it - I think this is one of the ones you can safely ignore (like warning 4786 about long names) Also make sure you don't expose it directly, such as
class Foo {
public:
map<int,int> & getTheIntMap() {
return m_map;
}private:
map<int,int> m_map;
}exposing it like so will cause you all sorts of problems - just don't go there. Wrap all access to the collection with functions for adding and removing, which it appears you are doing anyways. Also you might consider using STLPort - which may give you fewer headaches ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!