WasmFiddle lets you compile C/C++ code to WebAssembly and run it in the browser. The JavaScript harness on the right has several global variables and helper functions.
wasmCode: Uint8Array
The compiled WebAssembly buffer.
wasmImports: { … }
This object is automatically generated by WasmFiddle for your convenience. It’s a template containing function stubs for each imported WebAssembly function.
canvas: HTMLCanvasElement
WasmFiddle creates a 1200×1200 canvas element that you can draw into. You can display the canvas programmatically using lib.showCanvas().
log()
A simple logging function whose output is shown on the bottom right. You may also use the browser’s console object but you’ll need to open up the developer tools to see the output.
lib.UTF8ArrayToString(heap: Uint8Array, ptr: number)
Converts a C string into a JavaScript string.
lib.dumpMemory(heap: Uint8Array, ptr: number, len: number)
Prints memory contents.
lib.setStackPtr(heap: Uint8Array, ptr: number)
Sets the default stack pointer address.

See this online tool on this webpage.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translate »