Hi, I’m reaching out to discuss the possibility of adding official WebAssembly (WASM) support to GLib. Several projects, such as gst.wasm[1] (a WebAssembly build of GStreamer) and wasm-vips [2] (a WASM port of libvips), currently rely on GLib. However, since GLib does not officially support WASM, these projects have had to maintain forks with necessary modifications.
One of the key technical issues when running GLib-based code in WebAssembly is related to function pointers. Specifically, function pointers must be called with the correct type, or an abort(10) will occur in WASM environments[3]. Fixing this issue is the first milestone in making GLib more WASM-compatible.
Given the growing use of WebAssembly for multimedia applications, I’d like to ask:
Are there any plans or interest in supporting WebAssembly as a first-class target in GLib?
What are the key technical or architectural concerns that would need to be addressed for WASM support?
Would the GLib community be open to contributions aimed at upstreaming WebAssembly compatibility?
I’d love to hear your thoughts on this and whether it makes sense to work towards integrating WASM support directly into GLib.
[1] GitHub - fluendo/gst.wasm: WebAssembly port of GStreamer
[2] GitHub - kleisauke/wasm-vips: libvips for the browser and Node.js, compiled to WebAssembly with Emscripten.
[3] Function Pointer Issues — Emscripten 4.0.0-git (dev) documentation