- 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.
- Docker and Kubernetes for Java Developers
- ThinkPHP 5實戰
- Vue.js入門與商城開發實戰
- Learning Python Design Patterns(Second Edition)
- 碼上行動:用ChatGPT學會Python編程
- Learning jQuery(Fourth Edition)
- 微信小程序開發與實戰(微課版)
- Arduino計算機視覺編程
- Java 從入門到項目實踐(超值版)
- Web程序設計:ASP.NET(第2版)
- 網絡綜合布線與組網實戰指南
- Mastering Magento Theme Design
- AngularJS by Example
- Daniel Arbuckle's Mastering Python
- C++ Windows Programming