Is there a standard way to include .c source files?
So far I've been using extern "C" { ... }
to expose the functions, compiling .c to an object file, running rustc until ld chokes with an undefined reference, and using the arguments shown after error: linking with 'cc' failed with code 1; note: cc arguments: ...
to run cc myobjfile.o ...
Use the cc crate in a build script to compile the C files into a static library and then link the static library to your Rust program:
Cargo.toml
build.rs
src/example.c
src/main.rs
Luqman gave a hint on IRC; using
extern "C" { ... }
with#[link_args="src/source.c"];
in the crate file works for me.