Really nice bindings!
The unmanaged callbacks that use bool return values are marshalled incorrectly, as C# assumes they are 4-byte values. In some cases it may be fine with this, but in others it will crash.
[DllImport(BindgenInternal.DllImportPath, EntryPoint = "b2World_SetPreSolveCallback")]
public static extern void WorldSetPreSolveCallback(WorldId worldId, delegate* unmanaged<ShapeId, ShapeId, Manifold*, void*, bool> fcn, void* context);
This can be easily fixed by changing the return value to a byte instead of a bool, but it does mean you have to manually return a byte when implementing the callbacks. There may be a way to use the [MarshalAs] attribute here, but I'm not sure how to with these unmanaged function pointers.
[DllImport(BindgenInternal.DllImportPath, EntryPoint = "b2World_SetPreSolveCallback")]
public static extern void WorldSetPreSolveCallback(WorldId worldId, delegate* unmanaged<ShapeId, ShapeId, Manifold*, void*, byte> fcn, void* context);
Really nice bindings!
The unmanaged callbacks that use bool return values are marshalled incorrectly, as C# assumes they are 4-byte values. In some cases it may be fine with this, but in others it will crash.
This can be easily fixed by changing the return value to a byte instead of a bool, but it does mean you have to manually return a byte when implementing the callbacks. There may be a way to use the
[MarshalAs]attribute here, but I'm not sure how to with these unmanaged function pointers.