[cfe-dev] x64 windows (MinGW) and "__declspec(dllimport)" emits a "unknown attribute warning"

Ruben Van Boxem vanboxem.ruben at gmail.com
Fri Jul 15 13:59:33 PDT 2011


Hi,

This small piece of code:

> int main() {}
> __declspec(dllexport) void foo (int); void bar (void) { foo (0); }

emits following warning when Clang is built for x86_64-w64-mingw32,
but not when built for i686-w64-mingw32:

> foo.c:3:12: warning: unknown attribute 'dllexport' ignored [-Wattributes]
> __declspec(dllexport) void foo (int); void bar (void) { foo (0); }
>            ^
> <built-in>:128:38: note: expanded from:
> #define __declspec(a) __attribute__((a))
>                                      ^
> 1 warning generated.

Note that this code has an undefined reference, that's not the point.

I tried looking through Clang's code where this warning is emitted,
but can't find anything relevant. The code differentiating x86 and x64
(or most likely just "forgetting" x64 mingw) is probably deeper in the
code.

Any help is appreciated.

Ruben




More information about the cfe-dev mailing list