3 ms·
I’ve been enjoying writing libraries in C and being able to use them both from native applications and in web apps via WASM. I personally avoid emscripten and j
by david2ndaccount 4y ago
I’ve been enjoying writing libraries in C and being able to use them both from native applications and in web apps via WASM. I personally avoid emscripten and just implement the minimal C/JS glue and utilities myself.
- sjmulder 4y agoWhat library or such if any do you use for string.h/math.h/snprintf and such?
- david2ndaccount 4y agoFor snprintf I use stb sprintf [1]. For the reasonable functions from string.h (memset, memcpy, memmove), you can just use compiler builtins (__builtin_memset, etc.) as long as you enable the bulk memory extension (-mbulk-memory). I haven’t needed much of math.h for the stuff I’ve made, when I have I just called stuff on the `Math` object in javascript. [1] https://github.com/nothings/stb/blob/master/stb_sprintf.h https://github.com/nothings/stb/blob/master/stb_sprintf.h