__stdcall and __cdecl

__stdcall
http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx

__cdecl
http://msdn.microsoft.com/en-us/library/zkwh89ks.aspx

Stack-maintenance responsibility
__stdcall: Called function pops its own arguments from the stack.
__cdecl: Calling function pops the arguments from the stack
关于函数调用约定__cdecl 还是 __stdcall。我们可以在输出函数名前添加,也可以用cl编译的时候指明
/Gd 使用 __cdecl 调用约定 (C declaration,是C和C++默认格式),手动堆栈平衡(支持可变参数)
/Gz 使用 __stdcall 调用约定 (是pascal, fortran等的调用约定), 自动堆栈平衡
MSDN specfy:
The __stdcall calling convention is used to call Win32 API functions. The callee cleans the stack, so the compiler makes vararg functions __cdecl. Functions that use this calling convention require a function prototype.

The /Gz compiler option specifies __stdcall for all functions not explicitly declared with a different calling convention.

Functions declared using the __stdcall modifier return values the same way as functions declared using __cdecl.

On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler

 

source:http://www.cppblog.com/kenny/archive/2011/04/19/144539.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: