1
0
Fork 0
forked from fun/fun

Holiday is over, now I have fun again. No code changes. (0.38.11)

This commit is contained in:
Johannes Findeisen 2026-02-18 18:11:21 +01:00
commit 15082bdc3e
9 changed files with 78 additions and 78 deletions

View file

@ -3,8 +3,8 @@
This guide outlines how to embed the Fun VM in a host application and extend it from C/Rust.
## Overview
- The VM is implemented in C (see `src/vm/`).
- Optional Rust-based opcodes can be enabled via `FUN_WITH_RUST` (see `docs/rust.md`).
- The VM is implemented in C (see [src/vm](../src/vm/)).
- Optional Rust-based opcodes can be enabled via `FUN_WITH_RUST` (see [rust.md](./rust.md)).
## Embedding from C
While the exact API surface may evolve, a typical embedding flow looks like:
@ -14,7 +14,7 @@ While the exact API surface may evolve, a typical embedding flow looks like:
4. Execute entry function or script body.
5. Retrieve results and clean up.
See `src/vm/core` and related headers for public entry points and value types.
See [src/vm/core](../src/vm/core/) and related headers for public entry points and value types.
### Hosting considerations
- Threading: share VM state cautiously or create one VM per thread.
@ -22,8 +22,8 @@ See `src/vm/core` and related headers for public entry points and value types.
- Errors: propagate parse/runtime errors back to the host with useful messages.
## Extending with Rust
When `FUN_WITH_RUST=ON`, a Rust static library from `src/rust/` is built and linked. You can:
When `FUN_WITH_RUST=ON`, a Rust static library from [`src/rust/`](../src/rust/) is built and linked. You can:
- Implement new opcodes/functions in Rust.
- Expose a C ABI for the VM to call into.
See `docs/rust.md` for details and example code.
See [rust.md](./rust.md) for details and example code.