The book I'm using describes C++ 开发者_StackOverflowusage of COM and recommends __stdcall as a specifier, arguing that more languages use this method of stack cleanup.
However, I'm considering future interoperability with C#. Does C# use stdcall by default, or does it have to be specified?
With COM interop, it doesn't matter as much.
If you're using Platform Invocation Services (P/Invoke), with C#, then stdcall is the default. (Technically, it's Winapi, which defaults to Stdcall on the desktop), but it can be overriden in a DllImport
specification.
I would recommend using stdcall as the default specifier as it's the default used by C#. However, it's trivial to change the calling convention via "CallingConvention" attribute.
http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.callingconvention.aspx
精彩评论