[Insight-users] Re: ITK Wrappers and gcc_xml

Brad King brad.king at kitware.com
Thu Feb 16 10:14:49 EST 2006


Zachary Pincus wrote:
> On windows, itkMultiThreader.h declares that ThreadFunctionType is  
> LPTHREAD_START_ROUTINE. LPTHREAD_START_ROUTINE expands to "unsigned  
> long (__stdcall *)(void*)", as described here:
> http://www.massey.ac.nz/~mgwalker/misc/createthread.html .
> 
> The key bit is the __stdcall, which specifies how the function is to  be 
> called.
> 
> While gcc_xml "sees" the __stdcall (and provides a __stdcall__  
> attribute; no idea why the trailing underscores), CableSwig doesn't  do 
> anything with that attribute.
> 
> Thus, CablsSwig generates code that assumes that ThreadFunctionType  is 
> "unsigned long (*)(void*)". But VC++ defaults to declaring  functions 
> __cdecl if there isn't any call type. So VC++ sees the   typedef as 
> "unsigned long (__cdecl *)(void*)". Since __cdecl  functions are 
> incompatible with __stdcall functions, the compile breaks.

Nice, thanks for tracking that down.  FYI, the trailing underscores show 
up because __stdcall is not known to GCC so the preprocessor transforms 
it to __attribute__((__stdcall__)) or something like that which is the 
attribute that tells GCC to use the __stdcall calling convention (on 
MinGW for example).

-Brad


More information about the Insight-users mailing list