<div dir="ltr">Add the -fms-extensions flag to enable support for __cdecl and __stdcall, as well as other things like __declspec(dllexport).<div><br></div><div>Alternatively, pass a triple flag that doesn't mention mingw to get this behavior by default, like --target=i686-pc-win32.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 21, 2014 at 3:05 AM, fprijate <span dir="ltr"><<a href="mailto:prijatelj.francek@gmail.com" target="_blank">prijatelj.francek@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
Here is a sample code :<br>
<br>
typedef int (_cdecl * func1 )( void );<br>
typedef int (_stdcall * func2 )( void );<br>
<br>
which clang doesn't compile.<br>
Actually it compiles it on Win with compiler from   Windows snapshot builds<br>
<<a href="http://llvm.org/builds/" target="_blank">http://llvm.org/builds/</a>><br>
While on Ubuntu (apt-get ...) or on Windows  pacman from MSYS2<br>
<<a href="http://sourceforge.net/projects/msys2/" target="_blank">http://sourceforge.net/projects/msys2/</a>>   doesn,t compile.<br>
<br>
Problem is:<br>
While gcc preprocesor (mingw on win32 or gcc on linux) translates code to<br>
<br>
typedef int (__attribute__((__cdecl__)) * func1 )( void );<br>
typedef int (__attribute__((__stdcall__)) * func2 )( void );<br>
<br>
and then translates it to object file, clang preprocesor lives code as it is<br>
and then throws error.<br>
<br>
Solutuion:<br>
If i explicitly change source code to:<br>
<br>
typedef int (__attribute__((__cdecl__)) * func1 )( void );<br>
typedef int (__attribute__((__stdcall__)) * func2 )( void );<br>
<br>
and then compile it with clang , it compiles OK.<br>
<br>
regards<br>
Franček<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/clang-doesn-t-compile-simple-code-tp4038903.html" target="_blank">http://clang-developers.42468.n3.nabble.com/clang-doesn-t-compile-simple-code-tp4038903.html</a><br>

Sent from the Clang Developers mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>