cpp 0.5.2

Inline C++ code closures
Documentation

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.5"

[build-dependencies]
cpp_build = "0.5"

build.rs

extern crate cpp_build;

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

lib.rs

#[macro_use]
extern crate cpp;

cpp!{{
#include <stdio.h>
}}

fn main() {
unsafe {
cpp!([] {
printf("Hello, World!\n");
});
}
}