5 releases (3 breaking)

0.4.0 Apr 7, 2024
0.3.1 Mar 28, 2024
0.3.0 Mar 28, 2024
0.2.0 Oct 15, 2023
0.1.0 Sep 21, 2023

#189 in Programming languages

Download history 1/week @ 2024-02-14 6/week @ 2024-02-21 1/week @ 2024-02-28 250/week @ 2024-03-27 120/week @ 2024-04-03 18/week @ 2024-04-10

388 downloads per month

GPL-3.0-or-later

125KB
3.5K SLoC

cmajor-rs

Build Crates.io Docs.rs

Rust bindings for the Cmajor JIT engine.

Overview

Work-in-progress bindings for the Cmajor JIT engine, to enable embedding Cmajor programs in Rust apps.

Usage

Add this to your Cargo.toml:

[dependencies]
cmajor = "0.4"

You will also need to download the Cmajor library and tell the crate where to find it, either by:

  1. Passing the path on construction:

    use {cmajor::Cmajor, std::error::Error};
    
    fn main() -> Result<(), Box<dyn Error>> {
        let cmajor = Cmajor::new("path/to/libCmajPerformer.so")?;
    }
    
  2. Setting the CMAJOR_LIB_PATH environment variable (.env files are supported):

    CMAJOR_LIB_PATH=path/to/libCmajPerformer.so
    
    use cmajor::{Cmajor, std::error::Error};
    
    fn main() -> Result<(), Box<dyn Error>> {
        let cmajor = Cmajor::new_from_env()?;
    }
    

Crate Features

static (Experimental)

It is possible to statically link to Cmajor to avoid having to load the library dynamically at runtime. This will build the library from source, so you'll need to have the necessary build tools installed. This feature is disabled by default, and only has experimental support on macOS.

License

Licensed under GPLv3 (or later). Refer to the Cmajor licensing terms for more information.

Dependencies

~1–29MB
~394K SLoC