Again this is about MS standards... most of their libraries are written with StdCall.
Also note that the Wizards in the new Project dialog are only examples, for use by beginners. Most of us use the empty project set.
So does the Pelles C compiler ignore the __stdcall calling convention if it appears in a 64bit DLL, and replaces it with __fastcall?
And if so, (out of curiousity) why doesn't the wizard define it as __fastcall from the start, given that it's a 64bit DLL? Or is it merely following the Microsoft practice?
Also, I assume I am free to declare __fastcall as the calling convention in DLLs I may make?
MS Standards again ... Entry points are always CDecl ... which has to do with who cleans up what mess on the stack afterwards. (As Frankie explained)
I'm not sure I follow you here. SampleFunction is not the entry point, DLLMain is. Are you talking about the DLLMain entry point being __cdecl? And if it is, do you mean that every other exported function must follow the same calling convention as the entry point? (Which I didn't think was the case, but again, I'm new to this DLL stuff).
Again, it's the conventions talking ... FastCall is the standard for 64 bit programs and is the only one used by the 64 bit compiler. You can change this setting outside the IDE, but be ready for things to get ugly if you do...
If I understand what you mean: the compiler knows what it is doing, so it changes the __stdcall to __cdecl instead of to __fastcall (even though I think in the end __cdecl is ignored by the compiler and __fastcall is used, from what I've read), but I am restricted to __fastcall in the compiler options to prevent me from messing around (because the compiler is smarter).
This was not meant to sound in any way sarcastic, I'm just trying to figure out the rationale between the calling convention conversions the compiler tells me it is doing which go against the user restrictions it is imposing on me. On the other hand, does the __fastcall calling convention option in the compiler options merely indicate the
default convention to be used by function definitions/declarations that don't explicitly state one?
It pretty much comes down to decisions made by other people....
Sometimes you just gotta play along
Sounds about right. On the other hand, I would certainly like to know (even just a little) how Pelles C is implementing these conventions/decisions, and why. I just found it odd that everything I've seen regarding the sample DLL, etc, was everything
other than __fastcall, and the compiler then changed it something that was still
not __fastcall.
Thanks to you & Frankie, though the "why" is still haunting me a bit.