Take the following C test code. I want to make a DLL which exports stdcall HelloWorld function.
test.c: __attribute__((dllexport)) void __attribute__((__stdcall__)) HelloWorld() { } Compiling & linking it gives the following error during linking with GCC 4.3.0, while it works fine with GCC 3.4.5. $ i586-mingw32msvc-gcc -c -o test.o test.c $ i586-mingw32msvc-gcc -shared -o test.dll test.o Cannot export HelloWorld: symbol not found collect2: ld returned 1 exit status Examining the object file seems to reveal the problem, especially when compared to the GCC 3.4.5 mingw crosscompiler which is in Debian. GCC 4.3.0: $ i586-mingw32msvc-nm test.o | grep HelloWorld 00000000 T [EMAIL PROTECTED] $ strings test.o | grep HelloWorld -export:HelloWorld [EMAIL PROTECTED] GCC 3.4.5: $ i586-mingw32msvc-nm test.o | grep HelloWorld 00000000 T [EMAIL PROTECTED] $ strings test.o | grep HelloWorld -export:[EMAIL PROTECTED] [EMAIL PROTECTED] Notice the subtle difference in output of the last command. Between 3.4.5 and 4.3.0 the @0 stdcall decoration in the -export:[EMAIL PROTECTED] line got lost, which makes it impossible to link DLLs with exported stdcall functions. Here are some details about the compiler versions used for testing: $ i586-mingw32msvc-gcc-4.3.0 -v Using built-in specs. Target: i586-mingw32msvc Configured with: ../gcc/configure --prefix=/opt/mingw --target=i586-mingw32msvc --enable-languages=c --disable-multilib --disable-shared --enable-threads=win32 --enable-version-specific-runtime-libs --enable-sjlj-exceptions : (reconfigured) ../gcc/configure --prefix=/opt/mingw --target=i586-mingw32msvc --enable-languages=c,c++ --disable-multilib --disable-shared --enable-threads=win32 --enable-version-specific-runtime-libs --enable-sjlj-exceptions Thread model: win32 gcc version 4.3.0 20070424 (experimental) $ i586-mingw32msvc-gcc-3.4.5 -v Reading specs from /usr/lib/gcc/i586-mingw32msvc/3.4.5/specs Configured with: /build/buildd/mingw32-3.4.5.20060117.1.dfsg/build_dir/src/gcc-3.4.5-20060117-1-dfsg/configure -v --prefix=/usr --target=i586-mingw32msvc --enable-languages=c,c++ --enable-threads --enable-sjlj-exceptions --disable-multilib --enable-version-specific-runtime-libs Thread model: win32 gcc version 3.4.5 (mingw special) -- Summary: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tobivollebregt at gmail dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i586-mingw32msvc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680