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
If I try to use StabbyLibrary::get_stabbied on a function symbol named init_module, it returns something different compared to libloading and get_canaried.
To reproduce, rename the function called stable_fn to init_module in these two locations:
let stable_fn = lib.get_stabbied::<extern"C"fn(u8)>(b"stable_fn").unwrap();
Recompile, and notice how the println! from the library is no longer executed.
The returned function pointer executes something, but it is no longer the expected library function, and returns -1 instead. If -1 is not a valid value for the return type of the function, then this causes a segmentation fault when trying to use it.
This doesn't seem to happen when using the standard libloading without get_stabbied, nor when using get_canaried instead of get_stabbied.
Renaming it to anything else makes the issue go away.
My guess is it loads init_module from libc.so.6 instead for some reason? Do the libloading/RTLD flags or loading methods differ between get_stabbied and get_canaried?
I tried rustc 1.73 and 1.77.1, downloaded through rustup, on a NixOS 23.11 system, with libloading = "0.8.3" and stabby = { version = "4.0.4", features = ["libloading"] }.
The text was updated successfully, but these errors were encountered:
If I try to use
StabbyLibrary::get_stabbied
on a function symbol namedinit_module
, it returns something different compared tolibloading
andget_canaried
.To reproduce, rename the function called
stable_fn
toinit_module
in these two locations:stabby/examples/library/src/lib.rs
Line 16 in fac3d32
stabby/examples/libloading/src/main.rs
Line 34 in fac3d32
Recompile, and notice how the
println!
from the library is no longer executed.The returned function pointer executes something, but it is no longer the expected library function, and returns
-1
instead. If-1
is not a valid value for the return type of the function, then this causes a segmentation fault when trying to use it.This doesn't seem to happen when using the standard
libloading
withoutget_stabbied
, nor when usingget_canaried
instead ofget_stabbied
.Renaming it to anything else makes the issue go away.
My guess is it loads
init_module
fromlibc.so.6
instead for some reason? Do the libloading/RTLD flags or loading methods differ betweenget_stabbied
andget_canaried
?I tried rustc 1.73 and 1.77.1, downloaded through rustup, on a NixOS 23.11 system, with
libloading = "0.8.3"
andstabby = { version = "4.0.4", features = ["libloading"] }
.The text was updated successfully, but these errors were encountered: