You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Rust compiler does not provide any guarantee for ABI stability across FFI boundaries, so the calling convention, trait object layout, etc. might be different across compiler versions or even different builds. Some issues in current backend plugin implementation include
register_plugin is not extern "C";
register_plugin returns a trait object, which is not FFI-safe;
async_trait desugars to something like fn () -> Box<dyn Future>, which also returns a trait object;
@gaius-qi I think what @imtsuki mean is if we want to load .so dynamically as what the example doing now, we need to take ffi safety into consideration.
Currently Rust compiler does not provide any guarantee for ABI stability across FFI boundaries, so the calling convention, trait object layout, etc. might be different across compiler versions or even different builds. Some issues in current backend plugin implementation include
register_plugin
is notextern "C"
;register_plugin
returns a trait object, which is not FFI-safe;async_trait
desugars to something likefn () -> Box<dyn Future>
, which also returns a trait object;HeadRequest
are notrepr(C)
.client/dragonfly-client-backend/examples/plugin/src/lib.rs
Lines 31 to 51 in b2ff71c
I suggest to use some libraries like https://docs.rs/async-ffi/latest/async_ffi/ and https://docs.rs/abi_stable/latest/abi_stable/; or if we want to support plugins written in other languages, we might need to re-consider the interface design, particularly regarding how should we handle async operations like
Future
s.The text was updated successfully, but these errors were encountered: