Perhaps wasm-bindgen can help here? Another option would be to export functions that access the struct, which sometimes is the simplest thing for C.
On Fri, Mar 1, 2019 at 8:01 AM Franco Nicolas Bellomo <[email protected]> wrote: > Hi! > > In Rust is easy export functions. For example > > // main.js > extern {} > > #[no_mangle] > pub extern fn hello_world(n: i32) -> i32 { > n + 1 > } > > main {} > > and the .cargo/config file > > [build] > target = "wasm32-unknown-emscripten" > > [target.wasm32-unknown-emscripten] > rustflags = [ > "-Clink-args=-s EXPORTED_FUNCTIONS=['_hello_world'] -s ASSERTIONS=1" > ] > > And the I can call from JS. Now, the problem is when I try to export some > rust structs. In c++ you can embind class using EMSCRIPTEN_BINDINGS(). > How I can do some similar to Rust? > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
