DLL: how to properly export member variables in classes?

S

Seko

Hi,

I'm writing a simple, non-MFC DLL, and I'm trying to export a class with
__declspec(dllexport), but the compiler is giving warnings because of member
variables whose type is CString.

It says "warning C4251: 'CSomeClass::m_someVar' : class
'ATL::CStringT<BaseType,StringTraits>' needs to have dll-interface to be
used by clients of class 'CSomeClass'"
This only happens if CStrings are used.

If I add the same __declspec statement for each variable, it says: "error
C2071: 'CSomeClass::m_someVar' : illegal storage class

Any help would be welcome.

- David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top