Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
hello.c File Reference

Implements the OP_RUST_HELLO opcode (conditional build). More...

Go to the source code of this file.

Variables

case OP_RUST_HELLO

Detailed Description

Implements the OP_RUST_HELLO opcode (conditional build).

This opcode demonstrates calling into a Rust function from the VM. When FUN_WITH_RUST is enabled at build time, it retrieves a greeting string from Rust and pushes it as a VAL_STRING onto the VM stack. When Rust support is disabled, a runtime error is raised and Nil is pushed to keep stack consistency.

Definition in file hello.c.

Variable Documentation

◆ OP_RUST_HELLO

case OP_RUST_HELLO

OP_RUST_HELLO: () -> string | Nil

Behavior (FUN_WITH_RUST=ON):

  • Does not pop any values.
  • Calls fun_rust_get_string() and pushes the returned C string as a VAL_STRING. If Rust returns NULL, an empty string is used instead.

Behavior (FUN_WITH_RUST=OFF):

  • Raises a runtime error indicating missing Rust support.
  • Pushes Nil to maintain stack discipline.

Definition at line 34 of file hello.c.