c_variadic

The tracking issue for this feature is: #44930


The c_variadic language feature enables C-variadic functions to be defined in Rust. The may be called both from within Rust and via FFI.

Examples


#![allow(unused_variables)]
#![feature(c_variadic)]

fn main() {
pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize {
    let mut sum = 0;
    for _ in 0..n {
        sum += args.arg::<usize>();
    }
    sum
}
}