c# - Is the CallingConvention ignored in 64-bit .NET applications? -
when interacting 64-bit native library through explicitly 64-bit .net application via p/invoke, callingconvention property in dllimport attribute ignored?
i ask because on "traditional" x86 have specify way caller or callee cleans stack variables (as how function might use cpu registers etc); far understand, x64 has single convention, __fastcall (the added __vectorcall notwithstanding).
so clr go ahead , marshal function calls __fastcall x64 convention, regardless of set callingconvention property?
yes, ignored. 64-bit pinvoke marshaller supports x64 abi, loosely based on __fastcall. loosely. won't exception if specify callingconvention, shrugs off.
note __vectorcall not specific x64, there x86 variant. neither supported pinvoke marshaller, you'd have write c++/cli wrapper. there little point in having supported, .net jitters still have weak sse2/avx support. wee bit in system.numerics.vector ryujit jitter, new x64 jitter shipped vs2015 no near being able pass arguments method yet. harsh alignment requirement going require drastic clr rewrite, long distance future music.
Comments
Post a Comment