Cross compiling DLL

Michael Luich mluich at gmail.com
Thu Dec 18 21:00:10 EST 2008


Hello Everyone,

I'm trying to build a plugin by cross compiling from linux to windows
using mingw. The Linux version compiles and works, and the Windows
version compiles but gives me errors when it tries to load. I made a
test dll with the same code for the windows dll and it loaded fine
(errored missing purple_init)plugin) which leads me to believe my
windows dll stuff is correct.

Does anyone have any ideas? any way I can troubleshoot this?

Mike Luich

Error:
C:\Program Files\Pidgin\plugins\srencrypt.dll is not loadable: %1 is
not a valid Win32 application.


Windows dll code:
#ifdef BUILD_DLL
/* DLL export */
#define EXPORT __declspec(dllexport)
#else
/* EXE import */
#define EXPORT __declspec(dllimport)
#endif


Build line:
i686-pc-mingw32-gcc -shared -DBUILD_DLL -c srencrypt.c  -lws2_32
-lssl.dll -lcrypto.dll -DHAVE_CONFIG_H -I.
-DLOCALEDIR=\"/usr/i686-pc-mingw32/sys-root/mingw/share/locale\"
-DLIBDIR=\"/usr/i686-pc-mingw32/sys-root/mingw/include//pidgin/\"
   -DDATADIR=\"/usr/i686-pc-mingw32/sys-root/mingw/share/\"
      -I/usr/i686-pc-mingw32/sys-root/mingw/include/pidgin
        -I/usr/i686-pc-mingw32/sys-root/mingw/include/gtk-2.0
-I/usr/i686-pc-mingw32/sys-root/mingw/lib/gtk-2.0/include/
  -I/usr/i686-pc-mingw32/sys-root/mingw/include/libpurple
    -I/usr/i686-pc-mingw32/sys-root/mingw/include/atk-1.0
        -I/usr/i686-pc-mingw32/sys-root/mingw/include/cairo
        -I/usr/i686-pc-mingw32/sys-root/mingw/include/pango-1.0
         -I/usr/i686-pc-mingw32/sys-root/mingw/include/glib-2.0
           -I/usr/i686-pc-mingw32/sys-root/mingw/include/libpurple
            -I/usr/i686-pc-mingw32/sys-root/mingw/include/glib-2.0
                 -I/usr/i686-pc-mingw32/sys-root/mingw/include/nss3

-I/usr/i686-pc-mingw32/sys-root/mingw/include/nspr4
            -I/usr/i686-pc-mingw32/sys-root/mingw/include/gtk-2.0

-I/usr/i686-pc-mingw32/sys-root/mingw/include/atk-1.0
         -I/usr/i686-pc-mingw32/sys-root/mingw/include/cairo

-I/usr/i686-pc-mingw32/sys-root/mingw/include/pango-1.0
-I/usr/i686-pc-mingw32/sys-root/mingw/include/glib-2.0
-I/usr/i686-pc-mingw32/sys-root/mingw/include/glib-2.0/glib/
  -I/usr/i686-pc-mingw32/sys-root/mingw/lib/glib-2.0/include/
                                                    -Wall
-fno-strict-aliasing  -o windows/srencrypt.dll




More information about the Devel mailing list