PDA

View Full Version : why does the plugin use a different instance of msvcr90.dll from qtcore.dll?



qtofttt
4th July 2010, 16:17
I have a application based on qt 4.6.2(dynamically linking).
and it uses a codec plugin named qcncodecs4.dll, which stands for Chinese.
the plugin directory is set to the application folder using QApplication::setLibraryPaths(QStringList) in "main".
I built it with VS 2008. The corresponding MSVCRT is MSVCR90.dll and MSVCP90.dll.
It runs ok on windows xp sp3, which has MSVCRT90 in the C:\WINDOWS\WINSXS.
BUT, When the app runs on windows xp sp1, which has NO msvcr90.dll and msvcp90.dll in the C:\WINDOWS\WINSXS, it cannot load the codec plugin correctly.

the folder structure is as following :
myapp/
myapp/qtcore.dll
myapp/myapp.exe
myapp/codecs
myapp/codecs/qcncodecs4.dll
myapp/Microsoft.VC90.CRT/
myapp/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
myapp/Microsoft.VC90.CRT/msvcm90.dll
myapp/Microsoft.VC90.CRT/msvcp90.dll
myapp/Microsoft.VC90.CRT/msvcr90.dll

Finally, I tried to add A COPY OF "/Microsoft.VC90.CRT" to myapp/codecs, which looks as :
myapp/
myapp/qtcore.dll
myapp/myapp.exe
myapp/codecs
myapp/codecs/Microsoft.VC90.CRT/
myapp/codecs/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
myapp/codecs/Microsoft.VC90.CRT/msvcm90.dll
myapp/codecs/Microsoft.VC90.CRT/msvcp90.dll
myapp/codecs/Microsoft.VC90.CRT/msvcr90.dll
myapp/codecs/qcncodecs4.dll
myapp/Microsoft.VC90.CRT/
myapp/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
myapp/Microsoft.VC90.CRT/msvcm90.dll
myapp/Microsoft.VC90.CRT/msvcp90.dll
myapp/Microsoft.VC90.CRT/msvcr90.dll

This time , the application runs ok on windows xp sp1.
And after I inspected the proccess using procexp.exe, I found that TWO INSTANCES of MSVCRT90 were loaded, ONE for qtcore.dll, ONE for codec/qcncodecs4.dll, while there was only ONE INSTANCE of qtcore.dll in the process.

Why does the plugin use a different instance of msvcr90 from qtcore.dll, but the same instance of qtcore.dll as the caller?

qtofttt
5th July 2010, 05:23
Can some one help me , please?

ChrisW67
5th July 2010, 05:57
I'm not a Microsoft compiler user but as I understand it you will get two instances of side-by-side DLLs because the system is maintaining isolation between the one loaded by the codec dll, and the one loaded by the application. It only does this for libraries that the application or library carries a manifest entry for.

Why does it matter?

If I were you I'd deploy the MSVC++ redist runtime (into system locations) with your application rather than use private copies.

dbzhang800
5th July 2010, 06:12
Please read the manual: http://doc.qt.nokia.com/4.6/deployment-windows.html


To solve the problem, you have to remove the manifest from the plugins (embedded as a resource) by adding the following line to the .pro file of the plugins you are compiling:

CONFIG-=embed_manifest_dll

You can refer:
http://hi.baidu.com/cyclone/blog/item/d77a86182fb915b84bedbc57.html

qtofttt
5th July 2010, 08:17
I'm not a Microsoft compiler user but as I understand it you will get two instances of side-by-side DLLs because the system is maintaining isolation between the one loaded by the codec dll, and the one loaded by the application. It only does this for libraries that the application or library carries a manifest entry for.

Why does it matter?

If I were you I'd deploy the MSVC++ redist runtime (into system locations) with your application rather than use private copies.

It only does this for libraries that the application or library carries a manifest entry
This DOES help me. Thanks.

qtofttt
5th July 2010, 08:19
Thanks for your reply. The problem was resolved according to your msg.:)