Crates.io | janet-rs-sys |
lib.rs | janet-rs-sys |
version | 0.1.0 |
source | src |
created_at | 2023-09-25 18:44:00.865559 |
updated_at | 2023-09-25 18:44:00.865559 |
description | Raw Rust bindings to the Janet Programming Language |
homepage | |
repository | |
max_upload_size | |
id | 982970 |
size | 2,053,619 |
Raw Rust bindings to the Janet Programming Language
use janet_rs_sys::*;
use std::ffi::*;
fn main()
{
let result = unsafe { janet_init() };
assert_eq!(result, 0);
let env = unsafe { janet_core_env(std::ptr::null_mut()) };
let code =
CString::new(r#"(print "Hello World!")"#).unwrap().as_c_str().as_ptr();
let file = CString::new("hello-world.janet").unwrap().as_c_str().as_ptr();
let result =
unsafe { janet_dostring(env, code, file, std::ptr::null_mut()) };
assert_eq!(result, 0);
}
Currently, these bindings only work on Windows because of some strange errors
arising from bindgen using u128
on the FFI layer and subsequent warnings from
the compiler because of this. It's likely that there isn't much left to do to
get a Linux & MacOS version of this working but as of right now it proved too
difficult to work out what was wrong on Nix platforms.
These are required when using janet-rs-sys
in a project:
$ git submodule update --init --recursive
Visual Studio Developer Command Prompt is required to build on Windows during
development of janet-rs-sys
.