dtolnay/cxx

Support passing function pointers across the FFI

Open

#52 opened on 2020年3月2日

GitHub で見る
 (6 comments) (9 reactions) (0 assignees)Rust (4,472 stars) (253 forks)batch import
help wanted

説明

i.e. function parameters with the type fn(...) -> ....

#[cxx::bridge]
mod ffi {
    extern "Rust" {
        fn f(arg: u8, callback: fn(u8));
    }
}

fn f(arg: u8, callback: fn(u8)) {
    callback(256 - arg);
}

コントリビューターガイド