November 2019
Intermediate to advanced
448 pages
15h 6m
English
The ccall and cwrap functions accept an 'array' type, but the automatic memory management is only for 8-bit values. If your function is expecting an array with integers, for example, you’ll need to handle the memory management yourself by allocating enough memory for each element in the array, copying the contents of the array to the module’s memory, and then freeing the memory after the call returns.
A WebAssembly module’s memory is simply a typed array buffer. Emscripten provides several views that allow you to view the memory in different ways so that you can work with different data types more easily:
Read now
Unlock full access