Skip to content

Tart is a Rust library for compiling and linking code written in multiple languages by their native toolchains.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

GlowyDeveloper/tart-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tart

Crates License Version

Tart is a Rust library for compiling and linking code written in multiple languages by their native toolchains. This project is inspired by and contains adapted code from cc.

Currently supported languages

  • C
  • C++
  • Go

Features

Language support is controlled via Cargo features:

  • c
  • cpp
  • go

Examples

In your build.rs, you'd want to have this:

fn main() {
    tart::Build::new()
        .language(tart::Languages::C) // Whichever language you are using
        .add_file("src/my_file.c") // Path to your file
        .compile("my_lib"); // Name of your library
}

In your source files, your want to list your functions in an extern "C" block.

#[link(name = "my_lib")]
unsafe extern "C" {
    fn add(a: i32, b: i32) -> i32;
    fn multiply(a: i32, b: i32) -> i32;
    ...
}

Call your functions in a unsafe block.

unsafe {
    add(1, 2);
}

Each language is slightly different.

Check the examples folder for language specific syntax.

Licenses

This project is licensed under either of

at your option.

About

Tart is a Rust library for compiling and linking code written in multiple languages by their native toolchains.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages