Ok, this is pretty weird. I have a lightweight string class called "String" I also have a game engine that runs in a DLL. Now, I want to be able to return from a function in that DLL a copy of a locally held "String" Everything works fine UNTIL the real program (not the DLL) tries to destroy the String class returned by the DLL function.
In effect, it seems that when the String class is created in the DLL, its internal character array ( = new char[...]) is assigned memory from the DLL's local heap space. When the main program tries to destroy that String class, in String's destructor, it reads:
String::~String() {
delete [] data;
}
Pretty simple, except the main program gets basically a memory error because the allocation wasn't made by it.
Now I know I could get away with 100's of tricks, but I really just want to be able to return the String class
I don't want to have to pass a String* as a parameter, I don't want to use char arrays. I have now several functions that need to return Strings and more will follow.
It would be nice if someone could help me out here.
- Splat