RFD: FFI Interface(s)

It would be interesting, and possibly useful, to provide an FFI interface to allow Retro to call C (or other languages, depending on the VM) code.

This is likely to be challenging. I'd like to get feedback on whether this is something people would like to see me pursue in the future, and what libraries/functionality people who would use it need.

Assigned to
1 year, 8 months ago
1 year, 4 months ago
No labels applied.

~pontaoski 1 year, 8 months ago

I would probably make use of a C FFI for calling into GUI libraries & whatnot to display a graphical interface w/ Retro

~rickcarlino 1 year, 8 months ago

Could this be implemented in current Retro via devices? This is something I haven't needed yet, but have pondered. I am curious to see what API you had in mind for such a feature.

~crc_ 1 year, 8 months ago

I think it could be exposed via the device interface. I'm currently looking at libffi as a supporting library, as rolling this entirely on my own is likely to be difficult.

I've done FFI's before, back when Retro was native x86 code, but it'll be harder this time as there's more involved in terms of translating between Retro's memory model and that of the various host systems now). Knowledge of what people would like to see it support will be helpful in determining how to proceed on this.

E.g., as ~pontaoski mentions gui's, this would necessitate supporting callbacks, which introduces need for more bridging as I'll have to devise a way to construct C functionality that can call into Retro when the callback is invoked. This gets complicated as I'll need to ensure that the stacks and VM registers are kept consistent. (The multitasking project will likely be of help on this, as some of this is dealt with in that).

~crc_ referenced this from #66 1 year, 5 months ago

~rickcarlino 1 year, 5 months ago

I agree that a callback system would be useful, especially for eventually porting the VM to architectures that use interrupts.

~crc_ REPORTED IMPLEMENTED 1 year, 4 months ago

Register here or Log in to comment, or comment via email.