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
I think open should probably be marked unsafe, because it could call a unsafe function, although not directly.
For example, below code demonstrates a constructor function is called on library load (no unsafe code needed):
cargo new dlopen-test
cd dlopen-test/
cat > hello.c <<EOF#include <stdio.h>void __attribute__ ((constructor)) hello(void){ printf("hello from C\n");}EOF
gcc -Wall -shared -fPIC -o hello.so hello.c
cat > src/main.rs <<EOFextern crate dlopen;use dlopen::raw::Library;fn main() { let lib = Library::open("./hello.so").unwrap();}EOF
cargo add dlopen
cargo run
# some cargo outputs, ends with this print from C code
hello from C
The text was updated successfully, but these errors were encountered:
I think
open
should probably be markedunsafe
, because it could call a unsafe function, although not directly.For example, below code demonstrates a constructor function is called on library load (no
unsafe
code needed):The text was updated successfully, but these errors were encountered: