| (Note: we somehow lost the
rust-dev cc, see Stefan's e-mail below) Under the plan as I envisioned it in my head, ignoring the question about unsafety, it would be necessary to write a wrapper for a C function if you wanted it to have the same type as a Rust fn (as opposed to an `extern "C" fn()` type). However, I could imagine permitting extern fn items to be coerced to Rust type, and having the compiler auto-generate a wrapper. We plan to do something similar with top-level Rust fns: they will be coercable to a C function type, so that any Rust fn item can used as a callback, and not just an "extern fn". However, this of course immediately raises the question of unsafety: we could presumably want a way to declare that those C functions are safe as well. Another option is just to use a macro, of course. Or that would be an option if we supported item-level macros, which we hopefully will soon. The question I guess is how often this situation comes up. Is it just libmath? Or is this sort of thing extremely common when doing bindings? Niko
|
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev


