We are currently creating an API for a specific library. Part of the interface requires the library to receive and return custom classes, such as a vector and a string.
When you try to simulate using the library in a simple scenario, in debug mode, the system is suppressed when the string is delivered as input.
I believe that there is another representation of the string class in debug or release mode. Then our library expects to get a certain idea, to incorrectly read a data member and crush along the way. So what is the best way to pass STL objects to the API. The target OS is Windows XP compiled with MSVC 8, although the library user will use windows that their compiler could (and probably will) Ideas we have had so far:
- Change the string to char * - But then developers can confuse the responsibility of freeing memory.
- Use our own version of String - I don't want to develop another private string implementation.
- Release the debug version and debug version.
- Ask people about stack overflows for some option that we missed or don’t understand, or just heard from their experience.
Hagai source
share