PDA

View Full Version : Small DLL hell adventure



Piskvorkar
18th February 2010, 08:28
Hi!
I decide to inform user's here about my simply problem, which however I was solving for about three days. I've installed Qt 4.5.3 correctly a I was developing some program in Qt and everything was ok. I have developed it in MSVC 2005 and suddenly, I need to run my program in release without MSVC IDE. Some time before it runs ok, but now, program crashed after some actions was done. So I started to look for my error in program, something as uninitialized variable or something else. But everything seems ok.
The strange was, that when I run program in release under MSVC, it was ok. But when I run it from windows, it crashed. I had tried debugging in release and I found some memory overwrite there! Everything points to function QPainterPath::toSubpathPolygons(). But the problem was elsewhere. Fortunately I was given an idea, that I check all linked libraries. So I run it in MSVC and copy libraries list out. Then I run it from windows and than I attached the debugger. I copy list again and compare it. What was my surprise when I had seen Qt4Core.dll loaded form ...../MikTeX/tex/bin/Qt4Core.dll.

Whole problem starts, when I had one day installed the MikTeX. It had self added path to /bin to my PATH and my program was than loading it's Qt4Core.dll instead of correct DLL from Qt's bin. Than I detect, that my MikTeX are using Qt 4.2.1 (I mentioned above I'm using Qt 4.5.3).

And now my question. Is Qt DLL's naming ok? Do you thing that name Qt4Core is adequate. Couldn't it be named e.g. Qt4_2_1Core.dll or similar? Or is it my mistake and I should to check Qt's dll version in application myself? I know that Windnows have problems with dynamic libraries linking, but is't it solvable only by using correct names of DLLs?

Sorry for my terrible English, but i want to share my experience :-).
Thanks for an explanation of my question in last paragraph.

high_flyer
18th February 2010, 09:51
Qt DLL's naming ok? Do you thing that name Qt4Core is adequate. Couldn't it be named e.g. Qt4_2_1Core.dll or similar? Or is it my mistake and I should to check Qt's dll version in application myself? I know that Windnows have problems with dynamic libraries linking, but is't it solvable only by using correct names of DLLs?
Since windows doesn't have the notion of symbolic links, what you suggest would force applications to run only with one specific version of Qt due to differing names of the Qt dlls over varying versions.


Under linux you have no such problem since you can use symbolic links.

nish
19th February 2010, 06:59
Couldn't it be named e.g. Qt4_2_1Core.dll or similar?
yes i think they should do it like that. We have msvcrt80.dll, msvcrt90.dll, and even Qt3 use to have the version numbers (qt-mt336.dll remember?) i dont know why we are using the same name for the whole 4x series.

Piskvorkar
21st February 2010, 08:24
I think the reason is that Qt want to be able to run applications with different versions of Qt. But in my opinion, there should be no radical changes between different versions. Unfortunately my experiences are other. I have had to do nearly always some changes in my source code, when i use newer Qt library.
Sure, i can do dynamic checks of Qt's version in my application, but is it right?