Page 1 of 1

Changing a calling convetion

Posted: Fri Jul 01, 2011 1:20 am
by Nessphoro
Hey again,

This time around I was thinking to change a calling convention for some of my function to stdcall in this manner

Code: Select all

void __stdcall somefunction();
But G++ started to complain and said: "expected initializer before somefunction"

Any help?

Re: Changing a calling convetion

Posted: Fri Jul 01, 2011 2:44 am
by xenos
I guess it should look like this:

Code: Select all

void somefunction() __attribute__((stdcall));
See the GCC Manual.

Re: Changing a calling convetion

Posted: Fri Jul 01, 2011 4:53 am
by Solar

Code: Select all

void __stdcall foo();                // MSVC
void foo() __attribute__((stdcall)); // GCC
Needless to say that, as compiler-specific extensions, both notations are non-standard and non-portable.

Re: Changing a calling convetion

Posted: Fri Jul 01, 2011 7:20 am
by qw

Code: Select all

#define __stdcall __attribute__((stdcall))