22 releases

0.4.0 Jul 9, 2018
0.3.2 Sep 24, 2017
0.3.1 Jul 12, 2017
0.2.1 Mar 22, 2017
0.0.12 Nov 19, 2015

#20 in FFI

Download history 42/week @ 2018-05-05 23/week @ 2018-05-12 16/week @ 2018-05-19 103/week @ 2018-05-26 172/week @ 2018-06-02 63/week @ 2018-06-09 146/week @ 2018-06-16 55/week @ 2018-06-23 315/week @ 2018-06-30 79/week @ 2018-07-07 164/week @ 2018-07-14 102/week @ 2018-07-21 59/week @ 2018-07-28

448 downloads per month


lib.rs:

This crate cpp provides macros that allow embedding arbitrary C++ code.

Usage

This crate must be used in tandem with the cpp_build crate. A basic Cargo project which uses these projects would have a structure like the following:

crate
|-- Cargo.toml
|-- src
    |-- lib.rs
|-- build.rs

Where the files look like the following:

Cargo.toml

[package]
build = "build.rs"

[dependencies]
cpp = "0.4"

[build-dependencies]
cpp_build = "0.4"

build.rs

extern crate cpp_build;

fn main() {
    cpp_build::build("src/lib.rs");
}

lib.rs

#[macro_use]
extern crate cpp;

cpp!{{
    #include 
}}

fn main() {
    unsafe {
        cpp!([] {
            printf("Hello, World!\n");
        });
    }
}
MIT/Apache-2.0 license

Dependencies

Reverse deps