Hacker News new | past | comments | ask | show | jobs | submit login

Where are the great C++ WASM frameworks ? Rust is Ruling the Roost here. Has Figma open-sourced anything yet ?



Shameless plug: It's not C++ (but C instead, but of course also usable from C++), and not "great" as in "created by a big Silicon Valley company", but check out the sokol headers:

https://github.com/floooh/sokol

...live samples:

https://floooh.github.io/sokol-html5/index.html


I just compile my C++ Qt code with emscripten and it mostly works.

See for instance:

- https://qmlonline.kde.org/

- https://qt-webassembly.io/designviewer/

- https://www.canonic.com/


This may be a problem with the underlying C++ code but many of these demos are absolutely unusable through touch screens. The UI doesn't seem to know what to do with simple things like a drag motion or a tap. Canonic won't even open the soft keyboard on my phone.

It's good that these things render flawlessly in the browser but it seems like the platform still has some work to do.


Last time I checked, Rust still depends on C++ tooling like Emscripten, LLVM and Binaryen to "rule the Roost".


the entire C/C++ ecosystem are WASM frameworks, thanks to emscripten, you can basically use everything

rust is stuck with "rewrite everything to be usable", it can't consume any of that

zig on the other hand.. it can, i think it'll have a bright future


Rust wasm support seems quite excellent, though? I haven't had too many issues with getting wasm output out of Rust. Emscriptem, though, has been a whole different story. I suppose it depends on what tool chains you're used to using.

I don't expect Zig to do any better or worse than Rust in this regard.


Zig can (eventually) do better than Rust because it includes the ability to compile C/C++ code to WASM, Rust needs an external C/C++ compiler for this (so you're back to having to deal with Emscripten if you need to embed C/C++ libraries in your Rust project).


The same is true in reverse, though, you need an external Rust compiler if you include Rust code in your C++ project. Mixing compilers and languages will always cause conflicts, I don't think either Emscripten or Zig will be any different other than that Zig has some backwards compatibility with C/C++.


They are good for different things, atm. Rust is focused on people writing new code for the Web, and does well there. C++ is focused on porting existing applications, which works well for things like Unity, Photoshop, Google Earth, etc.

The reverse cases are sadly not that great atm. If you have a Rust application that uses SDL2 and OpenGL, for example, porting it to the Web is not that easy (you either need to port those APIs to something else, or mix Rust and C to get Emscripten's SDL2 and OpenGL support). And if you want to write new C++ code just for the Web, current bindings solutions are not polished enough.

But hopefully all those things will keep improving!


Huh? You don't need to mix Rust and C, Rust has direct Emscripten support. I've used it + rust-sdl2 for a game project.


True, but there is an unfortunate amount of bugs in that area. We (I'm an Emscripten dev) would like to look more into improving Rust's Emscripten support, but there have just been higher priority items for us (and I guess others) so far.


Yeah that's certainly true, I've had to use weird compiler flags to get it to work properly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: