Skip to content

Multi-viewport issue with function pointers. #9

@JunaMeinhold

Description

@JunaMeinhold
  • Struct layouts are verified. (double checked)

Cpp signature:

ImVec2(*Platform_GetWindowPos)(ImGuiViewport *vp); 

Expected C# signature:

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate Vector2 PlatformGetWindowPos(ImGuiViewport* viewport);

Doesn't work on windows.

Working signature on windows: (Created using the disassembly)

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate Vector2* PlatformGetWindowPos(Vector2* pos, ImGuiViewport* viewport);

Any thoughts why that could happen?
PS: I checked already the calling convention doesn't change anything. (set the cpp fn to __cdecl)

My thoughts:

  • A issue in the .NET Runtime.

Screenshot of the problem with the "correct"/expected signature
image

Screenshot with the workaround:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions