1

Brief: I use MinGW, Qt, CMake. I need to link Qt libraties dynamicaly while linking MinGW libraries statically.

Detailed: I use gcc option "-static". As i read in gcc man page this option prevents dynamic linking (meanwhile this option doen's affect libsndfile that links dynamically - how it is possible with "-static" option? Ok...). I have been told that by legal issues Qt does not allow to link it statically in closed-source application (but i don't change Qt's code), so i am interested in linking it dynamically (i have compiled 2 versions - static, dynamic - no problem with that). But i would like to link MinGW libraries statically while linking Qt dynamically (to reduce number of .DLL files coming with application).

Q: How to provide selective-statically linking?

pavelkolodin
  • 2,859
  • 3
  • 31
  • 74
  • Qt itself is linked against MinGW runtime dynamically. Even if you can link the runtime to your own code statically, Qt DLLs will still look for the dynamic version of the runtime. And then you will have 2 copies of the same runtime in the same execution space. – Stephen Chu Jul 17 '12 at 02:14
  • Nope, my Qt itself linket against MinGW statically, so i can completely get rid of DLLs. – pavelkolodin Jul 18 '12 at 09:45
  • Then you'll have one copy of the same C/C++ runtime in each of the Qt DLLs. That is *NOT* a good thing. http://stackoverflow.com/questions/787216/should-i-link-to-the-visual-studio-c-runtime-statically-or-dynamically – Stephen Chu Jul 18 '12 at 14:10

0 Answers0