-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StableAbi and Futures #72
Comments
I already worked on this myself, it's just that it hasn't been upstreamed yet: oxalica/async-ffi#10. But it should work perfectly. Anyway, it would be nice to have official support, or at least some docs point to this crate. Otherwise I wouldn't have known about it. |
Update: stable_abi support has been merged into master and will most likely be available in its next version. |
@marioortizmanero cool. I solved the problem a different way (in private code), simply using |
Could you show how?
Doesn't work for me even with the feature flag, claims it doesn't implement the trait, seems like versioning problem |
@yavko at the time, the code was private so I could not (though it's general enough I probably could have shared). However now that code is OSS: https://github.com/CACI-International/ergo/blob/ac1a2492e03fbdffc7df10e15ef6b08ca9b8277e/ergo_abi_stable/src/future/mod.rs |
I know this is too much to ask, but could you show an example of its usage? I got it to work in my codebase, but don't actually know how the |
Weird I'm getting the same issue I was getting with async-ffi |
That is unrelated to StableAbi. You are presumably using some async code that relies on tokio without using a tokio runtime. |
Well, thats the thing, I am, the ffi module calls tokio async calls, and then my code is loading that module and running it under a tokio runtime. |
You're problem is that the thread local state (which tokio relies on to provide the context) will not work across binary boundaries. Each binary gets its own copy of the thread local values. The |
Does this work for async-std/smol? And how are you doing it, have you patched it? Thanks for all the help so far! |
First of all, thank you for your significant contribution to have a stable rust ABI. I found almost everything I needed except for working with futures. There is however another crate named asyncFfi, which provides
#[repr(C)]
alternative to future-structs.I tried to have a NewType
MyFuture(async_ffi::FfiFuture)
which manually implements StableAbi, but I struggled to implement LAYOUT for it and I don't know if this is even possible. This leads to the following questions:#[repr(C)]
structs?The text was updated successfully, but these errors were encountered: