Skip to main content

cfunc/
cfunc.rs

1extern crate mruby_compiler2_sys;
2use mruby_compiler2_sys::MRubyCompiler2Context;
3
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    unsafe {
6        let mut cxt = MRubyCompiler2Context::new();
7        cxt.compile_to_c_function(
8            "puts \"Hello, mruby-compiler2!\"",
9            "init_test_func",
10            std::path::Path::new("examples/out.c"),
11        )?;
12    }
13    println!("Created examples/out.c");
14    Ok(())
15}