Saturday, May 10, 2008

Calling conventions for functions

Finally I got to know what WINAPI is :)

it is a calling convention.

When a function call is made, you have a choice on how to pass function variables to the stack, they can be passed right to left or left to right, also there is a choice on whether the caller or the callee should clear the stack.

Based on these choices and some other things, we have different calling conventions :

__stdcall or CALLBACK or WINAPI,__cdecl,__fastcall,__thiscall

Check out the following links for details:

http://msdn.microsoft.com/en-us/library/984x0h58.aspx

http://www.codeproject.com/KB/cpp/calling_conventions_demystified.aspx

http://www.cs.cornell.edu/courses/cs412/2001sp/resources/microsoft-calling-conventions.html

No comments: