PDA

View Full Version : Delay-loading libraries... And MinGW.



hickscorp
13th April 2012, 00:23
Hello everyone,

i'm aware this question isn't much related to Qt itself, but i feel very confident that most of the Qt gurus are also C++ addicts, and since the solution to that problem can help people here, i'll still give it a shot before going to stackoverflow.

So basically, i have a pretty big project involving multiple libraries and executables. Everything is Qt-based, and is compiled on Mac OS, linux and Windows.

i used to compile the Windows version via VS2008, but i really got bored maintaining both the .pro / .pri and the .vsproj version of the projects, so i switched to Qt creator on Windows, and since i really didn't need VS2008 anymore for anything other than project navigation, i installed a very simple MinGW toolchain environment and got rid of VS2008.

However... there is something i'm really embarrassed, the magic /DELAYLOAD switch that was present on the VS linker. Very very handy!! It basically was declaring the delayLoadHelpers in my binaries automatically, thus loading libraries only when required (Libraries that i don't have sources, so i can't recompile them as Qt "plugins", and wish to avoid making a Qt "plugin" wrapper around them).

Basically: How would i implement hand-made delay-loading of opaque windows libraries, without switching back to the Microsoft toolchain?
Is there anything around showing such technique in clear C / C++ without any superfluous code so i can really understand how one would implement it?

Thanks,
Pierre.