_cdecl vs _stdcall conventions:

_cdecl & _stdcall are two different calling conventions seen in pre .NET world. Here _cdecl is mostly used with C & C++ Environment. Here Calling function (caller) will be clearing the stack under the hood. This is default for CRT (C Runtime Library) environment.
Example:
void foo(int i) à _foo;
void foo(int i, int j) à _foo@8
Most of the Win32 (32 bit Windows OS) API’s will be of_stdcall type. Here called function (callee) will be doing the stack cleanup. Name decoration will be containing param count. Code foot print is small because clean-up code will be in only one place even there are multiple calls.
Example:
void foo(int i) à _foo@4 ; (An int param is 4 bytes in size!)
void foo(int i, int j) à _foo@8
Note: See the decorations that’s why they did not support optional params

No comments:

Post a Comment