If you have multiple relocatable DLLs loaded by your application, you must be VERY careful about the order of libraries being linked by ld. If you follow the same order as in the "specs" file, you should be ok. Here're are simple rules of thumb: simple C app: LIBS = -lmingw32 -lgcc -lmoldnames -lcrtdll -lkernel32 simple C app that needs USER32.DLL: LIBS = -luser32 -lmingw32 -lgcc -lmoldnames -lcrtdll -lkernel32 C++ DLLs: LIBS = -lstdc++ -lmingw32 -lgcc -lmoldnames -lcrtdll -lkernel32 C++ DLLs that need USER32.DLL: LIBS = -luser32 -lstdc++ -lmingw32 -lgcc -lmoldnames -lcrtdll -lkernel32 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ you get the picture, right ;-) The critical sub-sequence order is marked with ^^ above. Oh yes, another thing -- never link in kernel32 more than once. Of course, you can use 'gcc -dll' or 'c++ -dll' to have the libraries supplied automatically by gcc/c++ etc, so you'd never have to worry about library names (other than extra ones, such as -luser32 or -ladvap32 etc) or the link order.