Closed kkimdev closed 6 years ago
Currently rust-cpp does not detect exported functions from rust to add bindings in C++ land, though I may add that sort of functionality in the future. Your above example would work, however, in the current system, if you did this:
#[no_mangle]
pub extern fn callback() {
println!("Called from C");
}
cpp! {
raw {
extern "C" { void callback(); }
void function() {
callback();
}
}
}
I see, and thanks for the answer!
btw, I've found this, https://gitlab.com/rusty-binder/rusty-cheddar and I will be using this to generate C headers for now. Maybe we can consider supporting c header generation inside cpp! using Cheddar?
Yeah, I have considered adding some sort of rusty-cheddar integration to rust-cpp but I haven't had a clear enough idea of what exactly I would want it to look like. Once I figure that out & get time to implement it I'll probably have it behind a cheddar
feature gate.
Is this issue still valid?
Now one can do
fn callback() {
println!("Called from C");
}
cpp! {{
void function() {
rust!(xxx [] { callback() })
}
}}
Closing this since we have the rust!
macro now.
Is it possible to do something like this?