Comment by pornel
1 month ago
It can be done in 100% safe code as far as Rust is concerned (if you use `dyn Fn` type instead of c_void).
The only unsafe here is to demonstrate it works with C/C++ FFI (where void* userdata is actually not type safe)
1 month ago
It can be done in 100% safe code as far as Rust is concerned (if you use `dyn Fn` type instead of c_void).
The only unsafe here is to demonstrate it works with C/C++ FFI (where void* userdata is actually not type safe)
Yes but my problem wasn’t with the user data pointer but the fact that I needed a STATIC generic lambda. Static because the C library then forks and continues to call the lambda in the new process but I also type based conversions in it.