[Interest] Problem creating a dll that loads static Qt libraries (in mingw) -> final chapter

erick oliveira da silva eosilva2000 at ig.com.br
Thu Jan 19 17:18:05 CET 2012


Hi Till,


> Depending on your code it *might* be necessary (and hence correct
> behaviour) to export the /entire/ class!
>

In my case, I unfortunatelly really need to export functions, not classes.
And the same program works in Linux with gcc.


>
> This might be due to the generated code by moc, which needs also to be
> exported (and this can only be done by exporting the /entire/ class).
>
> But a very simple dll function, that just creates o QString object with
default content "Hello World" and print in screen (with printf() function),
doesn't link either.


> However, this should actually only be "effective" when you actually link
> /against/ your shared library, not when you try to link your library
> itself... but I understand your build process already fails at the later
> point, trying to build the shared lib itself.
>
> You say that it seems to work when using the MS compiler, right? IIRC
> depending on compiler switches the linker actually might /ignore/ missing
> symbols and your DLL seems to link fine - unless you actually try to use it
> (unless you link against another DLL /first/ which provides the missing
> symbols).
>
> So in the MSVC case: did you actually try to link against your DLL and
> call the exported method/function from a simple *.exe?
>

Yes, I tested. The shared libray works at windows Vista(.dll), when
compiled with visual studio and also works at Linux(*.so), compiled with
gcc. I also tested both shared libraries calling functions from them and
both work fine.


>
> Also as to rule out the very obvious: you DO use two /different/ static Qt
> versions, one compiled with an MSVC compiler (same version and compiler
> switches as your DLL, where applicable) and the other compiled with the
> gcc/MinGW environment (dito for switches) - right? ;)
>

Yes, I have different Qt libraries in different computers(and virtual
machines). Here in this laptop I installed qt only using mingw.


>
> (Well, you say it works when you export the entire class, so I strongly
> assume you do.)
>
>
> Personally I have never used a static Qt lib, so what you observe might
> indeed be a glitch somewhere (maybe even in the MinGW/gcc).
>
>
Thanks for your help,Till!


Best Regards,

Erick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120119/614a144f/attachment.html>


More information about the Interest mailing list