Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
go:wasmexport
Search
asuka
September 20, 2024
Technology
430
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
go:wasmexport
Niigata 5分 Tech #12
https://niigata-5min-tech.connpass.com/event/329653/
asuka
September 20, 2024
More Decks by asuka
See All by asuka
GoとSIMDとWasmの今。
askua
3
610
2025年ふりかえり
askua
1
250
ライブラリを公開してメンテナンスした一年
askua
0
110
Wasmの気になる最新情報
askua
1
400
Wasmのエコシステムを使った ツール作成方法
askua
0
440
Pure Goで体験するWasmの未来
askua
1
1.1k
Wasmで社内ツールを作って配布しよう
askua
0
330
Wasm元年
askua
0
390
wstdなんだか良さそう
askua
0
160
Other Decks in Technology
See All in Technology
Genie Code ワークショップ 応用編 / Genie-Code-Workshop-advanced
databricksjapan
PRO
0
310
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
0
230
Sony-DroidKaigi2026
sony
1
310
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
140
少人数データチームのDevin活用実践事例
runandy16
2
430
IDperturb: Enhancing Variation in Synthetic Face Generation via Angular Perturbation
sansantech
PRO
0
140
【試作】IoT x AIエージェント
happysamurai294
0
100
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
220
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
120
はじめてのDatabricks:技術者向けワークショップ / beginner-workshop
databricksjapan
PRO
0
150
Azure App Service / Container Apps の組み込み認証
kuniteru
0
190
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
140
Featured
See All Featured
Leo the Paperboy
mayatellez
8
2.2k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
660
Paper Plane (Part 1)
katiecoart
PRO
1
10k
Documentation Writing (for coders)
carmenintech
77
5.5k
GraphQLとの向き合い方2022年版
quramy
50
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Docker and Python
trallard
47
4.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.5k
Done Done
chrislema
186
16k
Transcript
go:wasmexport 2024.9 Niigata 5分 Tech #12
asuka (@a_skua) • 株式会社モニクル ◦ SWE / プロダクトSRE • WebAssemblyの同人誌を書いている人
◦ WebAssemblyでできること ▪ 商業誌版:実践入門WebAssembly ◦ ご注文はWASIですか? ◦ ご注文はWASIですか?? ◦ WebAssembly Cookbook vol.1 2 WHOIS
そういえば... 3 Niigata 5分 Techであんまり技術の話をしていない • N5T#5 AssemblyScriptではじめるWebAssembly入門 • N5T#8
技術書典16オフライン振り返り • N5T#10 エンジニアコミュニティ
Wasmの話をします
Go1.23時点のWasmサポート状況
Go1.23時点のWasmサポート状況 go:wasmimportという構文をサポートしている • Go1.21とWebAssembly 6 package main //go:wasmimport add a
func addA() int32 //go:wasmimport add b func addB() int32 var a, b int32 func main() { a = addA() b = addB() } import "./wasm_exec.js"; const go = new Go(); const { instance } = await WebAssembly.instantiateStreaming( fetch(new URL("main.wasm", import.meta.url)), { ...go.importObject, add: { a: () => 10, b: () => 20, }, }, ); go.run(instance);
Go1.23時点のWasmサポート状況 go:wasmimportという構文をサポートしているが,go:wasmexportはサポートされていない • Go1.21とWebAssembly 7 package main //go:wasmimport add a
func addA() int32 //go:wasmimport add b func addB() int32 var a, b int32 func main() { a = addA() b = addB() } import "./wasm_exec.js"; const go = new Go(); const { instance } = await WebAssembly.instantiateStreaming( fetch(new URL("main.wasm", import.meta.url)), { ...go.importObject, add: { a: () => 10, b: () => 20, }, }, ); go.run(instance);
• go:wasmexportはtiny-goには入っている • go:wasmexportはWasmを使う上で欲しい機能の一つ • 今年のはじめに go:wasmexportのプロポーザルがacceptされた • Go1.23には来なかったが,すでに対応済み ◦
cmd/compile: add go:wasmexport directive · Issue #65199 · golang/go · GitHub go:wasmexport 8 →Go1.24でgo:wasmexportが来る
Go1.24からはこう書けるようになる
Go1.24からはこう書けるようになる 10 package main //go:wasmexport add func add() int32 {
return a + b } //go:wasmimport add a func addA() int32 //go:wasmimport add b func addB() int32 var a, b int32 func main() { a = addA() b = addB() } import "./wasm_exec.js"; const go = new Go(); const { instance } = await WebAssembly.instantiateStreaming( fetch(new URL("main.wasm", import.meta.url)), { ...go.importObject, add: { a: () => 10, b: () => 20, }, }, ); go.run(instance); console.log(instance.exports.add());
go:wasmexport Niigata 5分 Tech #12