I have a C++ class inside a dll.
In that class I want to store data from a Curl callback into a member variable. I was going to use a stringstream like so:
void MyClass::CurlCallback( void * pvData, size_t tSize )
{
const char* data = static_cast<const char*>(pvData);
m_myStringStream << sata;
}
But when declare the stringstream in my class like so:
private:
std::stringstream m_myStringStream;
I get the following error:
Error 1 error C2220: warning treated as error - no 'object' file generated
Warning 2 warning C4251: 'MyClass::MyClass::m_myStringStream' : class 'std::basic_stringstream<_Elem,_Traits,_Alloc>' needs to have dll-interface to be used by clients of class 'MyClass::MyClass'
How can I declare this stringstream without getting this error?
I assume it is because stringstream is a C++ variable but the dll is expecting c style variables.
I have investigated maybe creating a class that stores the xml data like so:
class XMLData
{
public:
XMLData();
virtual ~ XMLData();
const char* GetXMLData() const { return xml; }
void Append( const char* xmlData ) { /*add xmlData to xml blah blah*/};
private:
//Add more here - to do
char* xml;
int length;
};
and declaring it:
XMLData* m_xmlData;
What is the best way to do this??