Comment by whizzter

Comment by whizzter 6 months ago

2 replies

Like the article says, you can have _opaque_ references. It's really a small step forward but does address a major pain point.

So for your first question. Yes you can hold a reference, so the major benefit is that dead objects via things like memory cycles aren't an issue any more (previously connecting objects between WASM and JS worlds needed manual references that outside of something like C++ RAII would be brittle).

For the second part, it would depend on the compiler but since Java/C++ would both live in a WASM world they should be possible to combine fairly painlessly (given a sane way to declare linked functions that are named properly), I'd put it's interoperability issues at the same level as PInvoke from C#.

torginus 6 months ago

PInvoke is awesome. If you use MSVC for C++ it can do stuff like SEH/stack debugging that goes from .NET frames to C++ and back.

  • pjmlp 6 months ago

    Even better, if Windows is the only deployment target, throw away P/Invoke, use C++/CLI and there is no need to guess how to get P/Invoke attributes exactly correct for each API call.