Biohazrd
Biohazrd copied to clipboard
Detect x86 calling convention when building for x64
For our purposes, calling convention attributes are really only relevant on x86. Clang knows this and returns cdecl for everything even if it's marked as stdcall/etc when building for x64 targets.
We should try to extract the x86 calling convention from the attributes even on x64 so that we emit function pointers with the correct calling convention. That way developers implementing UnmanagedCallersOnly
functions don't have to worry about their function only working with one architecture.
We also might consider exposing an option to skip emitting calling convention information entirely since the .NET unmanaged
default is generally suitable.
There's a chance this is exposed by PathogenArrangedFunction
, but I've not had a chance to check whether or not it has the same issue.