modu_ffi

Crates.iomodu_ffi
lib.rsmodu_ffi
version1.0.2
created_at2026-01-25 09:30:30.853289+00
updated_at2026-01-25 12:37:45.867638+00
descriptionFFI library for modu
homepage
repository
max_upload_size
id2068438
size3,226
Cyteon (cyteon)

documentation

README

modu_ffi

Makes implementing ffi functions for modu way easier

Example:

In rust:

use modu_ffi::*;

#[unsafe(no_mangle)]
pub extern "C" fn add(
    argc: std::ffi::c_int,
    argv: *const FFIValue
) -> FFIValue {
    if argc != 2 {
        panic!("add requires 2 arguments");
    }

    unsafe {
        let a = (*argv.offset(0 as isize)).value.integer;
        let b = (*argv.offset(1 as isize)).value.integer;

        FFIValue::integer(a + b)
    }
}

In modu:

import "ffi" as ffi;

let lib = ffi.load("./library_path.so"); // or .dll or .dylib
print(lib.add(1, 2));
Commit count: 0

cargo fmt