Skip to content

elaraproject/effi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Effi

Effi is Project Elära's minimal library for interfacing with C functions.

Example usage

use effi::*;

extern "C" {
    // Function signatures of all the C functions you want to call
    fn abs(n: c_int) -> c_int;
    fn sqrt(n: c_double) -> c_double;
    // ...
}

fn main() {
    unsafe {
        let n: i32 = -11;
        let n_2: f64 = 11.0;
        println!("The absolute value of {} is {}", n, abs(n as c_int));
        println!("The square root of {} is {}", n_2, sqrt(n_2 as c_double));
    }
}

About

Zero-dependency minimal library for C FFI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages