[Qt-interest] Dynamically loading a DLL from ressources
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Wed Feb 11 08:48:40 CET 2009
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Yves Bailly
> Sent: 2009-02-10 23:40
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] Dynamically loading a DLL from ressources
>
> Hello all,
>
> Here's what I tried in a small program (QtCreator RC1,
> Qt450 RC1, WindowsXP, MinGW).
>
> First, I created a resource file "ressources.qrc":
> <RCC>
> <qresource prefix="/dlls" >
> <file>my_dll.dll</file>
> </qresource>
> </RCC>
> ...and referenced it in the .pro file:
> QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
> RESOURCES += ressources.qrc
>
> Then in the main() function, I tried:
>
> QLibrary my_dll(":/dlls/my_dll.dll");
> my_dll.load();
>
> ...but the QLibrary::load() always fails, whereas it
> works fine if I try to load the same DLL from disk file.
>
> Am I doing something wrong? or is it simply impossible to
> load a shared library through ressources?
>
> Regards,
>
[Scott Aron Bloom]
I was never able to get that approach working...
However, you might want to use QFile, save the DLL to the local disk in
a known location, and load it from there...
Scott
More information about the Qt-interest-old
mailing list