- Learn WebAssembly
- Mike Rourke
- 170字
- 2021-08-13 15:38:55
C code to Wat
The upper-left pane in the following screenshot contains a simple C function that adds 2 to the number specified as a parameter. The lower-left pane contains the corresponding Wat:
If this looks familiar, it's because this same code was used for the explanation of Wat's s-expressions in the beginning of this chapter. Digging a little deeper, you can see how the C code corresponds to the Wat output. The addTwo() function is exported from the module as a string on line 5. Line 5 also contains (func $addTwo), which references the $addTwo function on line 6. Line 6 specifies that a single parameter of type i32 (an integer) can be passed in and the result returned is also an i32. Pressing the Build button in the upper-right corner (or above the C/C++ editor) will compile the C code into a Wasm file. The Wasm will be available for download or interaction with JavaScript once the build is completed.
- Getting Started with Citrix XenApp? 7.6
- 復雜軟件設計之道:領域驅動設計全面解析與實戰(zhàn)
- Kibana Essentials
- Delphi程序設計基礎:教程、實驗、習題
- Angular UI Development with PrimeNG
- Instant Apache Stanbol
- Unity 2020 Mobile Game Development
- 從學徒到高手:汽車電路識圖、故障檢測與維修技能全圖解
- Mastering AndEngine Game Development
- Elasticsearch for Hadoop
- 微信小程序項目開發(fā)實戰(zhàn)
- 大學計算機基礎實驗指導
- 單片機C語言程序設計實訓100例
- Kotlin極簡教程
- Web App Testing Using Knockout.JS