Interacting with JavaScript and Debugging

There's a great deal of exciting features and proposals in the works for WebAssembly. However, at the time of writing this book, the feature set is rather limited. As it stands, you can benefit greatly from using some of the features Emscripten provides. The process for interacting with C/C++ from JavaScript (and vice versa) will differ depending on whether you decide to use Emscripten.

In this chapter, we will cover how to utilize JavaScript functions with C/C++ code as well as how to interact with the compiled output of your C/C++ code from JavaScript. We'll also describe how Emscripten's glue code affects the ways a Wasm instance is utilized and how to debug compiled code in the browser.

Our goal for this chapter is to understand the following:

  • The differences between Emscripten's Module and the browser's WebAssembly object
  • How to call compiled C/C++ functions from your JavaScript code
  • How to call JavaScript functions from your C/C++ code
  • Special considerations to be aware of when working with C++
  • Techniques for debugging compiled output in the browser

..................Content has been hidden....................

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