Compiling the following 1 line program: __attribute__((__dllexport__, weak)) void* p = 0; with the following command: g++ -shared ld_test.c -LD:\mingw64\lib produces error: Cannot export p: symbol wrong type (2 vs 3) collect2.exe: error: ld returned 1 exit status Mixing same attributes on Windows+MSVC and Clang+Linux, GCC+Linux work well.