second-state / wasm-learning

Building Rust functions for Node.js to take advantage of Rust's performance, WebAssembly's security and portability, and JavaScript's ease-of-use. Demo code and recipes.
https://www.secondstate.io/articles/getting-started-with-rust-function/
485 stars 102 forks source link

Run nodejs example with c api #35

Open Galaxy0106 opened 2 years ago

Galaxy0106 commented 2 years ago

Hello, I‘d like to ask if I can use the official c-api to run the wasm module compiled in this project(e.g. k-means), or maybe I need some other things?

juntao commented 2 years ago

What is the "official c-api" you refer to? Thanks.

Galaxy0106 commented 2 years ago

Thank you for the reply and what I mean is https://wasmedge.org/book/en/embed/c/ref.html.

juntao commented 2 years ago

The WasmEdge C API can load a WasmEdge VM and run standard WASM files. However, some examples in this repo are compiled with wasm-bindgen, and they require special handling in the host. We do not currently support 'wasm-bindgen` in the C API.

Going forward, we plan to migrate all wasm-bindgen examples to wasmedge-bindgen. Currently wasmedge-bindgen is supported in our GO SDK, but we plan to support it in our NODE addon and C API as well.

https://wasmedge.org/book/en/embed/go/function.html