The C code

We'll use some very simple C code to test our compiler installation. We won't need to import any headers or external libraries. We won't use C++ for this test because we need to perform an extra step with C++ to prevent name mangling, which we'll describe in greater detail in Chapter 6Interacting with JavaScript and Debugging. The code for this section is located in the /chapter-04-installing-deps folder of the learn-webassembly repository. Follow the instructions listed here to test out the EMSDK.

Create a subfolder named /chapter-04-installing-deps in your /book-examples folder. Next, create a new file in this folder named main.c and populate it with the following contents:

int addTwoNumbers(int leftValue, int rightValue) {
return leftValue + rightValue;
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset