I have been using PInvoke to let my C# application call C++ functions I wrote.
Now, I keep hearing everywhere and beyond that I need to define those externally accessible functions with the __stdcall
convention. My question is: Why?
So far, I have accidentally ignored this advice, and everything works like a charm. When I add __stdcall
to my functions, everything keeps working in the same way (or at least it seems so).
This article says that __stdcall
is used for Win32 bit functions, but I am compiling against the x64 platform. Does that mean that I shouldn't be using __stdcall
after all or does it mean that I am missing out on something else?
And please, use simple English when responding. ;-) Lines like this (quoted from the article I linked):
The callee cleans the stack, so the compiler makes vararg functions __cdecl.
make my brain feel like there's tumbleweed blowing through it.