Skip to content

Is it possible to create a wasm file for an application that uses the C FFI? #160

Answered by brendanfh
davidbruce asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you are correct. When you run a program with onyx run ... it has extra logic to resolve the native C-FFI functions. This is a rather non-standard feature in the WASM world and it violates some of the isolation/security principles that WASM generally has, so I wouldn't expect any other runtimes to support anything like this. It only exists for Onyx to allow for support of more "useful" native things like Raylib/OpenGL/etc.

If you're curious about the implementation you can see some of the important functions here.
wasm_runtime.c#150
wasm_runtime.c#447

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@davidbruce
Comment options

Answer selected by brendanfh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants