Upgrade to Pro — share decks privately, control downloads, hide ads and more …

wasm-bindgen - その魅力と面白さ -

Misaki Makino
December 14, 2018

wasm-bindgen - その魅力と面白さ -

2018/12/14 Emscripten & WebAssembly night !! #6
で発表した内容です。

Misaki Makino

December 14, 2018
Tweet

More Decks by Misaki Makino

Other Decks in Programming

Transcript

  1. +4ͷۤखͳ͜ͱ Λิర ੈք؍Λਤʹͯ͠Έͨ .rs .cpp .c .go .kt .wasm .wat

    ςΩετԽͯ͠ ಡΉ͜ͱ΋Մೳ ৭ʑͳݴޠͷ ίϯύΠϧର৅ ❤ .js
  2. 3VTUͷϓϩάϥϜΛॻ͘ $ cargo new --lib add_one $ cd add_one command

    line [lib] crate-type = ["cdylib"] Cargo.toml #[no_mangle] pub extern fn add_one(x: u32) -> u32 { x + 1 } src/lib.rs
  3. wasm-bindgenΛ࢖͏  $ wasm-pack build // wasm-pack: ͜ͷίϚϯυͰࣗಈ࡞੒͞ΕΔ command line

    pkg/js_hello_world.js .d.ts bg.d.ts .wasm .js .json QLH഑Լʹࣗಈੜ੒
  4. wasm-bindgenΛ࢖͏  $ npm init $ npm install -D webpack

    webpack-cli webpack-dev-server command line webpack.config.js