Question

I have a Qt application using Qt 4.8.5. This application is dependent on a DLL that was built using Qt 4.6.0. Let's call it "MyDLL.dll".

I cannot rebuild MyDLL.dll to update it to a more current version of Qt. Since both my application and MyDLL require the QtCore and other DLLs, and the versions are different, how do I organize my files such that they don't conflict?

MyDLL is required at startup, so I can't use any delay load methodologies.

edit: To be clear, this question came up because the MyDll.dll was built using a custom Qt 4.6.0 from modified source, and my application is using a custom build of 4.8.5. The modifications weren't necessarily the same in both versions, so I didn't want to assume that I could still use the 4.8.5 DLLs. Turned out that it worked out in this case, but the question stands.

Was it helpful?

Solution

You shouldn't be having any issues. Qt maintains binary compatibility over minor and patch releases (see http://qt-project.org/wiki/Qt-Version-Compatibility) and an application/DLL built with 4.6.x will run fine when bound to 4.8.x runtime.

  • Your MyDLL.dll built with 4.6.0 will run with 4.8.5 runtime DLLs.
  • Your application built with 4.8.5 will run with 4.8.5 runtime DLLs.
  • Your application will run fine with MyDLL.dll as long as you are using the same interface you've always been using.

If you are seeing issues it is because of something else, and you will need to clarify exactly what problem you are having.

If you are not seeing issues and are just asking preemptively, then 1) just proceed as normal with no special considerations, and 2) you should have tried it first!

OTHER TIPS

Welcome to DLL Hell! :(

This is a huge problem under Microsoft windows, since the standard isn't to build version information into the DLL file name (like with Linux .so files).

You won't be able to accomplish what you are after if you link directly against "MyDLL.dll" since it will be looking for QT DLLs (like QtCore, QtGui, etc). The stock Qt DLLs contain no version decoration in the filename, so there will be a conflict as to which one to load. Also, you will likely not be able to link correctly in the first place (due to the conflicts. Qt doesn't play well with older versions).

The only possibility might be to create a separate executable that links against Qt 4.6.0 and MyDLL, and use some out-of-process communication between your main app and the server. COM might work in this case, but it largely depends on what your dll actually does.

The only other course of action would be to downgrade your main application and fix it at Qt 4.6.0.

Jason C's answer got it right. Also note the following:

  1. MyDll.dll must be compiled with the same compiler version as the rest of your application.

  2. The version of Qt used to build MyDll.dll should have had the same major configuration flags as the version of Qt that you're currently using. Things such as Qt namespaces, QThread support, etc. must all be the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top