Reputation: 5262
The book I'm using describes C++ usage 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?
Upvotes: 0
Views: 551
Reputation: 7621
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
Upvotes: 2
Reputation: 564433
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.
Upvotes: 2