-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
On ARM/ARM64, the current Hexa.NET.ImGui bindings break because C# cannot handle homogeneous vector aggregates (HVAs) correctly. Functions that take or return ImVec2, ImVec4, or similar types fail at runtime due to ABI mismatches.
Root Cause:
- ARM64 ABI passes HVAs in SIMD registers.
- C# P/Invoke does not support HVAs, leading to corrupted arguments/returns.
- Works on x86/x64 because ABI rules differ.
Proposed Solution:
Develop a C++ → C generator for the bindings:
- Automatically generate C ABI-safe wrapper functions from the ImGui C++ API.
- Replace vector-type parameters/returns with scalar equivalents or plain structs with const ptr.
- Expose only C-style functions to C#, ensuring ABI compatibility across ARM/ARM64 and x86/x64.
Benefits:
- Eliminates manual binding errors.
- Ensures ARM64 compatibility.
- Keeps API surface consistent for managed consumers.
Action Items:
- Prototype CPP→C generator for a subset of ImGui functions. HexaGen#29
- Replace existing vector-type interop in Hexa.NET.ImGui.
- Validate ARM64 runtime behavior with generated wrappers.
Notes:
- This approach is preferable to attempting direct P/Invoke of C++ vectors.
- Could be extended in the future for other C++ libraries with similar issues.
Metadata
Metadata
Assignees
Labels
No labels