Use StdCall calling convention by default
It appears that calli callsites cannot be decorated with the “platformapi” calling convention like DllImport signatures can. This is problematic since Windows uses stdcall by default and most other platforms use cdecl. There are three approaches to this issue, without going back to delegate calls: (a) generate an unmanaged thunk that cleans up the stack after a GL call; (b) use libFFI; (c) use cdecl *or* stdcall everywhere and hope that the runtime can cope. .Net 2.0 can detect and fix stdcall functions invoked through a cdecl callsite. .Net 4.0 adds a configuration option to enable or disable this fixup (faster p/invoke if disabled) and raise a MDA exception when this condition is detected. (This affects x86 only.) Mono appears to be able to cope with cdecl functions invoked through a stdcall callsite. More testing is required.
This commit is contained in:
parent
438f83c8d9
commit
6ccab1784f
1 changed files with 1 additions and 1 deletions
|
@ -415,7 +415,7 @@ namespace OpenTK.Rewrite
|
|||
{
|
||||
var signature = new CallSite(reference.ReturnType)
|
||||
{
|
||||
CallingConvention = MethodCallingConvention.C,
|
||||
CallingConvention = MethodCallingConvention.StdCall,
|
||||
};
|
||||
|
||||
foreach (var p in reference.Parameters)
|
||||
|
|
Loading…
Reference in a new issue