M.M
M.M

Reputation: 141574

Should I use __stdcall on DLL export functions?

I'm writing a small DLL in C using mingw-w64, which should be callable by VB.net programs. The only exports are functions whose parameters and return types are primitive types.

Should I use __stdcall on the dllexport functions or not?

When searching the web I have seen examples both with and without it. There is discussion of how it affects name decoration but no advice as to whether this is a good thing or not, and what the impact is on my DLL's usability.

Upvotes: 2

Views: 736

Answers (1)

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215259

There is really no good reason to use nondefault calling convention/ABI (__stdcall or otherwise) anywhere except when you need to call an existing interface defined that way. It's just gratuitous ugliness. Where it's done all over existing Windows stuff, it's legacy cargo culting from the Win16 era, and has no actual rationale behind it.

Upvotes: 1

Related Questions