|
|
|
|
|
by KenanSulayman
2397 days ago
|
|
Interestingly this is very similar to how I implemented passing closures into JavaScriptCore as hooks for JS class invocations ("function calls"). [0] Essentially it's taking advantage of the fact that closures are static methods with "implicit" data pointers. It should be fairly obvious that this is a massive violation of safety and undefined behavior, and most likely to break when debugging symbols etc. are inserted. The safest way to do this until Rust has figured out a stable-enough-ABI for closure passing would be a thread-local trampoline, I guess. Not very nice.. [0] https://github.com/psychonautwiki/rust-ul/blob/master/src/he... |
|
For callbacks the overhead likely isn't significant.