Skip to content
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

How to use slices in get_stabbied? #95

Open
xxshady opened this issue Nov 3, 2024 · 1 comment
Open

How to use slices in get_stabbied? #95

xxshady opened this issue Nov 3, 2024 · 1 comment

Comments

@xxshady
Copy link

xxshady commented Nov 3, 2024

I tried to use stabby::slice::Slice to write the same:

.get_canaried::<extern "C" fn(&[u8])>(b"unstable_fn")

But it failed to compile

error: implementation of `IStable` is not general enough
   --> src/main.rs:165:65
    |
165 |         let exit_fn: extern "C" fn(stabby::slice::Slice<u8>) = *llib.get_stabbied(b"exit").unwrap();
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `IStable` is not general enough
    |
    = note: `IStable` would have to be implemented for the type `for<'a> extern "C" fn(Slice<'a, u8>)`
    = note: ...but `IStable` is actually implemented for the type `extern "C" fn(Slice<'0, u8>)`, for some specific lifetime `'0`
@xxshady
Copy link
Author

xxshady commented Nov 3, 2024

extern "C" fn(data: *const u8, len: usize) compiles fine, so I guess it is the current workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant