Changing a calling convetion

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Changing a calling convetion

Post 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?
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Changing a calling convetion

Post by xenos »

I guess it should look like this:

Code: Select all

void somefunction() __attribute__((stdcall));
See the GCC Manual.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Changing a calling convetion

Post 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.
Every good solution is obvious once you've found it.
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: Changing a calling convetion

Post by qw »

Code: Select all

#define __stdcall __attribute__((stdcall))
Post Reply