views:

157

answers:

1

Hi.

I have a Qt app that uses another library where the function output is std::string instead of a QString.

So in my program I have a method

void doSomething() {
...
std::string std_string = MyExternalLibraryThatReturnsSTLstring.getString();
QString myQString = QString::fromStdString(std_string);
...
process(myQString);
...
}

When my external lib returns a not-empty std::string everything works fine. But when an empty std::string is returned, the app crashes at the end of the scope. I guessed that has to do with destruction of the std::string object(?).

The conversion to QString works fine, even with an empty std::string.

Can someone tell my why this happens, and how to avoid this run-time error?

(In other threads some people have discussed mixing of debug and release libraries, but I dont think that I have done that. How to find out btw?)

A: 

Use "dependency walker" to see on which DLL's your application (and the external DLL, and the QT DLL) are relying.

Patrick
ok..I did that and it uses only the standard Qt libs + my external.dll which again uses a lot of stuff. I cant really tell if there is something wrong or not here, but it does not seem like it.
Magus