Console API for Web Assembly (Streamed and Windowed)
+Console C API for Web Assembly (Streamed and Windowed)
This section describes twr-wasm's method of providing and abstracting console I/O in Web Assembly Modules.
C character based input/output is abstracted by struct IoConsole
.
Consoles can be "tty" aka "streamed", or they can be "windowed" (aka a "terminal").
diff --git a/azure/docsite/api/api-c-d2d/index.html b/azure/docsite/api/api-c-d2d/index.html index a176324f..724e0a29 100644 --- a/azure/docsite/api/api-c-d2d/index.html +++ b/azure/docsite/api/api-c-d2d/index.html @@ -138,7 +138,7 @@2D Draw API for Web Assembly
+2D Draw C API for Web Assembly
This section describes twr-wasm's C D2D API, which allows your Web Assembly module to call many of the JavaScript Canvas APIs. There is also a C++ canvas wrapper class in the balls example.
Examples
On Github
https://github.com/twiddlingbits/twr-wasm
-Version 2.0 vs. 1.0
+Version 2 vs. 1
-
-
- libc++ for wasm/clang is now available +
- libc++ built for Web Assembly is included
- most of the standard C library is now implemented -
- instructions for source level debugging +
- instructions for Web Assembly C/C++ source level debugging
- version of library with debug symbols provided
- locale, UTF-8, and windows-1252 support
Version 2.0.0 Limitations
+Version 2 Limitations
-
-
- libc++ not built with threads, rtti, exceptions, unicode, or wide char support +
- libc++ not built with exceptions enabled
- some standard C library functions are not 100% implemented
- Designed to work with a browser. Not tested with or designed to work with node.js
- Not all of compile-rt is ported (but most bits you need are) @@ -310,5 +310,5 @@
- Use Chrome @@ -148,7 +148,7 @@
- you need to ensure that the web server/browser can find the source code
- also see Example Readme
Post Feedback
diff --git a/azure/docsite/more/debugging/index.html b/azure/docsite/more/debugging/index.html index 5c17cec0..1765347c 100644 --- a/azure/docsite/more/debugging/index.html +++ b/azure/docsite/more/debugging/index.html @@ -130,12 +130,12 @@Debugging
+Debugging Web Assembly
This section describes some tips for debugging your Web Assembly (asm) program.
-Debug & Release libs
+Debug and Release libraries
There are release (twr.a) and debug (twrd.a) versions of the twr-wasm C library. See the examples for use of both. The "debug" version has debug symbols enabled and is built with -O0
. The "release" version has no debug symbols and optimization is set to -O3
. Both have asserts enabled. In general, you should use the "release" version unless you wish to step through the twr-wasm source -- in which case use the "debug" version.
libc++.a is not built with debug symbols.
-C/C++ Source Level Debugging
+Source Level Debugging Web Assembly C/C++
In order to enable C/C++ source debugging with wasm and clang, do the following:
C/C++ Source Level Debugging
Useful Functions
+Useful twr-wasm Debug Functions
Use twr_conlog
to print 'printf' style to the JavaScript console from C (reference is elsewhere in this doc.)
#include "twr-wasm.h"
@@ -156,7 +156,7 @@ Useful Functions
twr_conlog("hello 99 in hex: %x",99);
Use twrWasmModule.divLog()
to print to a div inside JavaScript code (reference is elsewhere in this doc.)
Testing Without a Web Server
+Testing Web Assembly Without a Web Server
Note: If you use this technique, you will not be able to get the c/C++ DevTool chrome extension to run, and so source level debugging won't work.
You can execute and debug JavaScript with wasm from local files without an HTTP server. It might be helpful to download the twr-wasm source code from github when you do this (so you can step through the twr-wasm typescript code as needed).
diff --git a/azure/docsite/search/search_index.json b/azure/docsite/search/search_index.json index d6abf6db..334e01cb 100644 --- a/azure/docsite/search/search_index.json +++ b/azure/docsite/search/search_index.json @@ -1 +1 @@ -{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"twr-wasm - Easy C/C++ Web Assembly Modules Documentation for twr-wasm Version 2.0.6 twr-wasm is a simple, lightweight and easy to use library for building C/C++ Web Assembly code directly with clang. It solves some common use cases with less work than the more feature rich emscripten. twr-wasm is easy to understand, and has some cool features. You can input and print streaming character i/o to a