| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 5 | |
Consider the following situation:
I have got an application that is built with Qt and able to load plugins
(dll's). The application is built in release mode.
The plugins don't need to be built using Qt. For that reason, the plugin
interface contains a method:
const std::string & name() const = 0;
that needs to be implemented by each plugin. The following reference
implementation is available to developers:
const std::string & AbstractPlugin::name() const {
return( m_name );
}
where m_name is a member of class AbstractPlugin. The application
transforms the std::string to a QString by calling:
QString::fromStdString( plugin->name() );
All developers are provided with the release-version of the application.
If they build their plugin in debug-mode, start debugging, i.e. the
application is started from within Visual Studio 2005, an error is
detected when converting a std::string to QString.
Any ideas or suggestions? Even printing the strings to console gives
strange characters, that is, the string is completely scrambled.
Cheers,
Thomas
Summary:
Qt 4.3.0 built for Visual Studio 2005
Qt Integration for Visual Studio 2005
Release Version of application, debug versions of the plugins.
--
[ signature omitted ]
Thomas Voß schrieb: > [...] The application > transforms the std::string to a QString by calling: > > QString::fromStdString( plugin->name() ); > > All developers are provided with the release-version of the application. > If they build their plugin in debug-mode, start debugging, i.e. the > application is started from within Visual Studio 2005, an error is > detected when converting a std::string to QString. > [...] Hmm, as this is about std::string rather than QString, the problem seems to be related to the runtime libraries rather than Qt. Do both application and plugins use the same setting for the runtime libraries? IIRC the recommendation is to use "Multi-threaded DLL" (compiler option /MD) for both. Best Regards / Mit freundlichen Grüßen Rainer Wiesenfarth -- [ signature omitted ]
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
> Hmm, as this is about std::string rather than QString, the problem seems > to be related to the runtime libraries rather than Qt. Do both > application and plugins use the same setting for the runtime libraries? Yes, both application and plugin use the same setting for the runtime libraries, although it is quite difficult to force vs 2005 to build Multi-Threaded DLLs in debug mode. Nevertheless, the problem still exists. Could it be linked to the "implicit" loss of data that is mentionend in docs when constructing a QString from const char*? Best Regards, Thomas -- [ signature omitted ]