SharpGenTools icon indicating copy to clipboard operation
SharpGenTools copied to clipboard

Calling Convention

Open MikhailGorobets opened this issue 3 years ago • 0 comments

Hi @jkoritzinsky, I noticed that SharpGenTools generates the wrong kind of calling convention, for example instead of cdecl we get thiscall

struct InterfaceWithProperties
{
    virtual bool __cdecl IsTrue() = 0;
    virtual int __stdcall GetValue() = 0;
};
public partial class InterfaceWithProperties : SharpGen.Runtime.CppObject
{
    // ...

    public unsafe bool IsTrue()
    {
        bool __result__;
        byte __result__native;
        __result__native = ((delegate* unmanaged[Thiscall]<System.IntPtr, byte> )this[0])(NativePointer);
        __result__ = 0 != __result__native;
        return __result__;
    }

    public unsafe int GetValue()
    {
        int __result__;
        __result__ = ((delegate* unmanaged[Stdcall]<System.IntPtr, int> )this[1])(NativePointer);
        return __result__;
    }
}

MikhailGorobets avatar Nov 10 '22 20:11 MikhailGorobets