I seem to remember Oskari saying something along the lines of "machines should no longer use the fastcall calling convention" but I can't remember what was said. It was a long time ago, maybe on BuzzChurch?
Looking through my machines, the only one that doesn't use fastcall is IX Split (uses cdecl) but they all seem to work okay. I ask because I've been getting weird random exceptions when I'm debugging magic, ever since I started using VS2018. Wondering if the calling convention might be an issue.
fastcall?
Re: fastcall?
i'm even using vectorcall and it seems to work... but the documentation for that says it doesn't touch member functions by default.. (so they remain thiscall i guess). There seem to be no such guarantees for fastcall however... so maybe just switch to vectorcall and see.
https://docs.microsoft.com/en-us/cpp/cp ... ew=vs-2019
https://docs.microsoft.com/en-us/cpp/cp ... ew=vs-2019
in any case, as long as you decorate your buzz-interfacing functions as cdecl, it should work and you can use whatever other calling convention for the rest of your application. machineinterface.h already specifies cdecl for some functions (like GET_INFO or CREATE_MACHINE), so if you implement them as cdecl everything should be fine imho, at least up to the point of creating the machine.
Would be good if Oskari could clarify tough what calling convention should be used for implementations of CMachineInterface/CMachineInterfaceEx/CMICallbacks etc (thiscall? i think that's standard for member calls anyway, but might get mangled by having /Gr on fastcall?). Until then i would just try to see if you still get crashes if you switch to /Gv. Also you should notice that functions get called with seemingly wrong arguments if you use the wrong calling convention.
https://docs.microsoft.com/en-us/cpp/cp ... ew=vs-2019
https://docs.microsoft.com/en-us/cpp/cp ... ew=vs-2019
in any case, as long as you decorate your buzz-interfacing functions as cdecl, it should work and you can use whatever other calling convention for the rest of your application. machineinterface.h already specifies cdecl for some functions (like GET_INFO or CREATE_MACHINE), so if you implement them as cdecl everything should be fine imho, at least up to the point of creating the machine.
Would be good if Oskari could clarify tough what calling convention should be used for implementations of CMachineInterface/CMachineInterfaceEx/CMICallbacks etc (thiscall? i think that's standard for member calls anyway, but might get mangled by having /Gr on fastcall?). Until then i would just try to see if you still get crashes if you switch to /Gv. Also you should notice that functions get called with seemingly wrong arguments if you use the wrong calling convention.