gcc 0.3.4

A build-time dependency for Cargo build scripts to assist in invoking the native C compiler to compile native C code into a static archive to be linked into Rust code.
Documentation

A library for build scripts to compile custom C code

This library is intended to be used as a build-dependencies entry in Cargo.toml:

[build-dependencies]
gcc = "0.2"

The purpose of this crate is to provide the utility functions necessary to compile C code into a static archive which is then linked into a Rust crate. The top-level compile_library function serves as a convenience and more advanced configuration is available through the Config builder.

This crate will automatically detect situations such as cross compilation or other environment variables set by Cargo and will build code appropriately.

Examples

Use the default configuration:

extern crate gcc;

fn main() {
    gcc::compile_library("libfoo.a", &["src/foo.c"]);
}

Use more advanced configuration:

extern crate gcc;

fn main() {
    gcc::Config::new()
                .file("src/foo.c")
                .define("FOO", Some("bar"))
                .include("src")
                .compile("libfoo.a");
}