nagisa / rust_libloading

Bindings around the platform's dynamic library loading primitives with greatly improved memory safety.
https://docs.rs/libloading
ISC License
1.24k stars 102 forks source link

Not working with wasm #119

Closed ziyak97 closed 1 year ago

ziyak97 commented 1 year ago

Hey I am trying to build my code using wasm-unknown-unknown. wasm-pack build -t web

I get the following error when doing so

libloading::Library::new(full_path).expect("Could not load the jvm dynamic library")
   |                         ^^^^^^^ could not find `Library` in `libloading`

Would this mean the libloading::Library is not compatible with web browsers?

nagisa commented 1 year ago

Correct – you cannot use libloading with wasm as wasm does not inherently provide any mechanisms to load any other code (except if we maybe count components). You will have to write a host function that does this for you and expose such loading functionality to your wasm code that way.