How can an MSVC program call a MinGW DLL, and vice versa?
Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use gcc -shared -o testdll.dll testdll.c \ -Wl,–output-def,testdll.def,–out-implib,libtestdll.a to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you have already the DEF file you may easily produce one by the Microsoft LIB tool: lib /machine:i386 /def:testdll.def Once you have testdll.lib, it is trivial to produce the executable with MSVC: cl testmain.c testdll.lib Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify the LIB files directly on the command line after the main program. For example, after cl /LD testdll.c use gcc -o testmain testmain.c testdll.lib The other way is to produce the .a files for GCC. For __cdecl functions (in most cases), it is simple: you only need to apply the reimp tool from Anders Norlander (since his web site is no longer avai