Macro chiter::make_fn [] [src]

macro_rules! make_fn {
    ($address:expr, $returntype:ty) => { ... };
    ($address:expr, $returntype:ty, $($argument:ty),*) => { ... };
}

A macro to convert a pointer into a function

Example:

// This code is in C.
int add_one(int thing) {
    return thing + 1;
}
// This code is in Rust. 0xDEADBEEF is the address where add_one starts.
let add_one = unsafe { make_fn!(0xDEADBEEF, i32, i32) };

assert_eq!(add_one(400), 401);