paritytech / polkavm

A fast and secure RISC-V based virtual machine
Apache License 2.0
258 stars 59 forks source link

Feature Request: C Wrapper/Callable from C #132

Open jockm opened 5 months ago

jockm commented 5 months ago

Forgive me for not knowing the right terminology as my knowledge of rust is shallow at the moment, but it would be great to see a wrapper, or whatever so that Polka is callable from C as a library or such.

Do you have any plans for this?

koute commented 3 months ago

Eventually, yes, but probably not in the short term. (Unless someone wants to contribute; PRs are welcome.)

With the new API that I've committed yesterday it should be relatively straightforward to create a C API. You'd essentially expose an opaque wrapper around the RawInstance and Module types, and then just expose functions for most of the methods defined there, plus some extra auxiliary functions to construct a ProgramBlob.