rodrimati1992 / abi_stable_crates

Rust-to-Rust ffi,ffi-safe equivalents of std types,and creating libraries loaded at startup.
Apache License 2.0
536 stars 30 forks source link

Examples don't compile, and I need some help #97

Closed ShayBox closed 1 year ago

ShayBox commented 1 year ago

I'm a bit new to rust, so maybe this isn't a great beginner project, but the examples don't compile, and they're a little complicated to understand, maybe some less-generic examples using "new" cargo workspaces would help.

I'm following working_with_abi_stable source which seems to compile and I mostly understand it.

I'm trying to expand my own project which interfaces with OSC to send and receive messages, and I want to send the received messages to all loaded plugins and allow plugins to send messages to the core application which will send them off via OSC.

This example tries to load libmin.so but each plugin would be under a different name such as libspotify.so or liblogger.so for example, how would I load multiple plugins that have the exact same interface? The example interface being MinMod and MinMod_Ref

ShayBox commented 1 year ago

Also abi_stable uses a very old once_cell version (>=1.0.0, <1.10.0) which conflicts with clap (^1.12.0), abi_stable will not compile with many other dependencies/libraries/craates, please expand compatibility (Update once_cell or remove it as listed in Cargo.toml)
My temporary solution is to use 0.10.4 until 0.11 comes out

ShayBox commented 1 year ago

I figured out how to load multiple matching plugins via #92
Now I'm trying to add a buffer parameter buf: [u8; 0x600] but I get
the associated item 'STABLE_ABI' exists for struct 'GetTypeLayoutCtor<[u8; 1536]>', but its trait bounds were not satisfied the following trait bounds were not satisfied: '[u8; 1536]: abi_stable::StableAbi'
image

rodrimati1992 commented 1 year ago

Now I'm trying to add a buffer parameter buf: [u8; 0x600] but I get the associated item 'STABLE_ABI' exists for struct 'GetTypeLayoutCtor<[u8; 1536]>', but its trait bounds were not satisfied the following trait bounds were not satisfied: '[u8; 1536]: abi_stable::StableAbi'

That's simple, abi_stable 0.10 has a minimum required Rust version of 1.46.0, and requires that you enable stuff that uses const generics with either of these crate features: "rust_1_51" or "rust_latest_stable"

ShayBox commented 1 year ago

Ah thank you, that's what I needed 👍