Closed mishushakov closed 8 months ago
Hey @mishushakov, while we don't have any minimal examples, I think the JSI implementation on top of the C ABI would be a great starting point. That provides a full implementation of JSI on top of the C-API, and so it uses all of the currently available operations.
The design mirrors JSI very closely, since it is primarily intended to be used through the C++ JSI API, so if you're familiar with JSI, most of it should be familiar. hermes_abi.h
specifies and documents the APIs, with the actual implementation of that API in hermes_vtable.cpp
, and the reference JSI implementation on top of it in HermesABIRuntimeWrapper.cpp
.
That's very helpful, thank you so much!
Right now I'm looking at reimplementing the JSI in Rust on top of the C ABI. The only issue I'm experiencing is my incompetence in C++, so I have to basically reverse-engineer your HermesABIRuntimeWrapper.cpp
reference implementation by hand. I saw someone attempted building a Rust wrapper before using cxx, but I haven't managed to get it running and it seemed more oriented at extending React Native rather than a generalised use-case.
Here's some progress on Hermes + Rust:
Going to close the issue, since this is not really a bug. Will follow up with new Issues when I have any findings with the C-ABI.
Maybe a good source of inspiration for the Hermes team when designing the C ABI: https://developer.apple.com/documentation/javascriptcore/c_javascriptcore_api
I'm trying to use the experimental C ABI in (hermes/API/hermes_abi), but I'm seeing only structs in
hermes_abi.h
file. Do you have any examples how to initialise a minimal runtime and execute a given code?Thank you!