Hi! Just want to share my experiment with using Rust and WebAssembly. I tried to port Vange-rs project (rust + wgpu) to browser. I used emscripten and unknown platforms. Both finally works, but have lot of obstacles. I am very sad about support level of emscripten in Rust, hope it will change at some day.
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVF2wUiuKH1%3DivMhfjuAFdtMwvHxc0YaS4V%2BGoGfBWuy6w%40mail.gmail.com.
Ah, language and toolchain interoperability, one of my favourite topics ;)Zig has nearly the same problems as Rust: it allows to compile to WASM, it has both a WASI and Emscripten target, with the WASI target working out of the box, but I gave up on the Emscripten target because I just couldn't get it to work.
IMHO it would be great if the Javascript shims and interop could be somehow split out of the Emscripten SDK into a separate, smaller "webapi-wasm-tools" SDK which could be better integrated with other language toolchains. The goal should be that other programming languages can benefit from the work that went into the Emscripten SDK to access web APIs like WebGL, WebGPU, WebAudio etc... up to "EM_JS()" functionality, instead of having to duplicate this work, or requiring a separate installation of the whole Emscripten SDK.There's a very promising project https://github.com/schellingb/wajic by Bernhard Schelling which has the same goals and which was used to port Mattias Gustavsson's DOS-like library to the web: https://mattiasgustavsson.com/wasm/Anyway... just my 2 cents :)-Floh.On Friday, 24 December 2021 at 15:16:23 UTC+1 caiiiycuk wrote:Hi! Just want to share my experiment with using Rust and WebAssembly. I tried to port Vange-rs project (rust + wgpu) to browser. I used emscripten and unknown platforms. Both finally works, but have lot of obstacles. I am very sad about support level of emscripten in Rust, hope it will change at some day.
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/99cc45ea-2307-4551-94b8-ecff9ad965a0n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/9e88b4b5-f110-4d90-a630-1c282a1febffn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVFgNcSPR-KFe35yg%2BU9NXFpG7U_Y5G0APbkZRf5UM2%2B8w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRH1%2BxWEaTbjTvnk5kE5W4XwUjHefP8g1psk-pUvxVAtg%40mail.gmail.com.
Let's look closer to my case. I ported C++ game Vangers to the web (https://www.gamepix.com/play/vangers). Vangers community did big work to integrate vange-rs (rust 3d render, based on wgpu) and Vangers game. It works as follow:1. Vange-rs provide c ffi interface2. Vange-rs compiled with rust to static library3. Vangers linked with Vanger-rs to executableNow I want to port vangers + (vange-rs render) to the web. wgpu didn't support wasm32-unknown-emscripten, I added experimental support for emscripten and it works. BUT, wgpu is developing to fast, so my changes become outdated very fast :)When I implement support for emscripten, I only disabling wasm32-unknown rules and uses native code paths everywhere. So, it's little bit strange, to work with emscripten you need to disable workarounds for wasm32. emscripten emulates native platform, so code that correctly uses posix system should work also in emscripten.Maybe there is any way to just use native static library and link it with emscripten? Like this:1. Compile vange-rs static library (with native triple)2. Compile vangers project with emscripten3. Link 1+2 with emscripten
for (1.) I can't use emscripten triple because of #[cfg] rules for wasm32 target, they select wrong code path (non-native).
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVEBtYrS_8fFYz9fmWoQNUwWqjXah%2B9f0cdZ4Jjd2%2BxVGQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpTmf%3DjhApcxA%3DoW6G_eOTDLLwyPyJbduWQnJqWBQj8EqA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVEOxJmiieN552iJW2M7SQK9kOoQTu8--iVNQFmB8rCz_w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/3b1ec71f-be17-4c3e-b74a-69a7ba867e42n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVGN0%2Bd%3DN-%2BRHs%3Dj-Hc3c-cu%3D4VRNTsY4zGiR6q2p4xBGQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CADdUJT8Da4wG0XYfvy20fJs7VECP8dvHvWLJcc5sGxrJ3Qfc9A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVFfwfN35VwgHFYxqvGMtGka%3DmpQqW_qDNkz%2BSNnGyoTMQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRK3Ao6cEwOrzC-6Dea%3D2K-XLEiqWbuNrbZdgNB8CdOxA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVGp485hWowDYM2XGJPj-nkZZTur5SukLNyr5c23%2BO73Xg%40mail.gmail.com.