How do you make a WASM library?

Continuing the discussion from Is it possible to compile WASM from Rust using C libraries?:

@kthakore It is preferable to create new topic instead of replying to very old topics. You can use the "Reply as linked topic" button. I created this topic for the new discussion.


I think we need to understand what want to do with the WASM. A WASM library isn't a cdylib.

1 Like

I can see where the cdylib - wasm library connection comes from. The mdn link doesn't explain cdylib but assures it is needed.

They do link to this: Linkage - The Rust Reference

--crate-type=cdylib, #[crate_type = "cdylib"] - A dynamic system library will be produced. This is used when compiling a dynamic library to be loaded from another language. This output type will create *.so files on Linux, *.dylib files on macOS, and *.dll files on Windows.

That unfortunately doesn't mention wasm, which leads to questions like this that explain in more detail why wasm uses cdylib.

2 Likes

Thank you will do!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.