Function ucc::bindgen

source ·
pub fn bindgen(
    source_list: impl IntoIterator<Item = impl AsRef<Path>>,
    dest: impl AsRef<Path>
)
Expand description

Generate universal bindings for export "C" functions inside a specified c++/cuda source, and write that binding to a Rust source under OUT_DIR/uccbind.

Usage:

ucc::bindgen(["csrc/source.cpp"], "source.rs");

You can then use that source in your Rust program like this:

mod ucci {
    include!(concat!(env!("OUT_DIR"), "/uccbind/source.rs"));
}

This generates AsRef/AsMut for cpu bindings, and AsURef/AsUMut for cpu/gpu bindings. the functionality is guessed by the suffix of function name: xxxx_cpu or xxxx_cuda.