uniffi-rs
25ba41db - Fix for multiple crates defining async functions

Commit
2 years ago
Fix for multiple crates defining async functions A single global callback won't work if there are multiple foreign modules. In `main` we handle this by inputting a callback in `poll()`. In `release-v0.25.x` we can't change `UNIFFI_CONTRACT_VERSION`, so instead we keep the `rust_future_continuation_callback_set` scaffolding function, then have the scaffolding code pass the callback to `rustfutures.rs`. Added some tests for this in `fixtures/ext-types/proc-macro-lib`. Things worked on Swift and Python for me because that code was based on leaking a pointer and it happened to work if the pointer came from another module. It just halted on Kotlin though and I think the same would happen if I wasn't on CPython and the alternate PointerMangager was used.
Author
Committer
Parents
Loading