[semi OT] how to link a mingw32 Qt4 app to a msvc6 lib ?

Alexander Neundorf neundorf at kde.org
Fri Jan 6 20:16:48 CET 2006


Hi,

I am no Windows expert and I have a problem.
I have a Qt app which I wrote under Linux, now I ported it to Qt4, and since 
there is now also a GPL version of Qt4 for Windows, I tried to build it under 
Windows too. So far I almost succeeded, it just fails too link. It links 
without problems to the Qt libs, but something goes wrong when I try to link 
to a library which was compiled using msvc 6.
Is it actually possible to link a mingw application to a msvc 6 library (plain 
C interface) ?
When trying to link, I get undefined references to all functions of the 
library.
The header of the library looks like this:

#ifdef _MSCVER

#define FOO_CALL __stdcall

#if defined FOO_EXPORTS
   #define FOO_DLL_SPEC __declspec(dllexport)
#else
   #define FOO_DLL_SPEC __declspec(dllimport)
#endif

#else  // this was the gcc/linux path:
  #define FOO_CALL
  #define FOO_DLL_SPEC
#endif

FOO_DLL_SPEC int FOO_CALL foo_init();

Now I don't know how to define FOO_CALL and FOO_DLL_SPEC with mingw gcc. The 
library is compiled with the settings as given here, i.e. with __stdcall. Do 
I have to use them same with mingw gcc ? Does it use the same keywords then ? 

Any hints would be very appreciated
Alex
-- 
Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list