官术网_书友最值得收藏!

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:

C function and 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.

主站蜘蛛池模板: 乌什县| 蓝田县| 合山市| 苍南县| 安丘市| 方城县| 新野县| 扎兰屯市| 海丰县| 永胜县| 类乌齐县| 苍溪县| 桑植县| 漳浦县| 安岳县| 辽宁省| 台东市| 滕州市| 察隅县| 松阳县| 乐至县| 唐海县| 海门市| 永康市| 峨眉山市| 闸北区| 成都市| 宜宾市| 宝山区| 雷州市| 明水县| 佛山市| 南开区| 旌德县| 千阳县| 馆陶县| 句容市| 宣武区| 彭阳县| 永善县| 廊坊市|