mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-25 10:00:44 +01:00
Function pointer arguments given to the guest thunk library aren't callable on the host, so they need special handling on a case-by-case basis. Similar problems arise when the guest-side tries to consume a pointer returned from a native host library. To automate some common scenarios, this change adds two new annotations: "callback_guest" indicates the callback parameter is never called on the host and hence can be marshalled like any other argument. Accidental host calls to the function pointer are prevented by wrapping it in an opaque type alias. "returns_guest_pointer" indicates that the host function returns a pointer usable in the guest context. This applies e.g. to functions that derive the returned pointer from input guest pointer arguments.