We're currently working on a project trying to port a desktop app to Blazor to make it cross-platform. We would like to use libraries like OpenCV, OpenTK and WebAudio.
We think that we can compile each of these libraries into WASM, and naively we thought we would have been able to use these compiled libraries in a Blazor app. However, we have so far failed to do this, experiencing similar errors/issues to these...
Example 1
Example 2
So far, we have been successful if we instead go via JS interop for OpenCV (for example, using openCV.js, which I believe if OpenCV compiled to WASM with JS bindings) and for OpenGL. This is not a good solution due to the performance hit this imposes, particularly if we start passing large arguments, which must be serialised and then deserialised.
My question
How can I use packages written in C++, C, Rust... in Blazor without having to go via JS interop? If there is, please could you direct me to a minimum working example, or perhaps some documentation. We are not against using JS for other parts of the website, but using it as the glue to stick together the bits of code for which performance is most important is not a viable option for us.
I think something along the lines of this is what we need, but I can't find any examples of this being used.
note
If it is possible to combine all these langauges and libraries in one big WASM executable and run that as a website, but without using Blazor then that is also a viable option. Please let me know if thats a possibility