AssemblyScript / examples

A collection of AssemblyScript examples.
https://assemblyscript.org
MIT License
291 stars 51 forks source link

No example that demonstrates binding to C/C++ #30

Open adv-sw opened 7 months ago

adv-sw commented 7 months ago

Inspected examples here : https://github.com/AssemblyScript/examples

We have a web assembly SDK implemented in C++.

Want to be able to link AssemblyScript to to it.

So need to be able to call AssemblyScript from C++ & C++ from AssemblyScript.

Nothing fancy, simple types. Or C interface & can figure out from there.

CountBleck commented 7 months ago

That really depends on the type of runtime, like WasmEdge, wasm3, Wasmer, or Wasmtime, as well as the way data is passed in your APIs.

CountBleck commented 7 months ago

Also, I'm assuming this C/C++ code is on the host side (not compiled to Wasm). We don't yet support linking with C/C++ that's compiled to Wasm.

adv-sw commented 7 months ago

The C++ code is compiled to wasm. The binding required is on the wasm side, hence the runtime is not important (as I understand it). There is binding to host side, which is resolved via this C++ API, hence why I want assemblyscript binding wasm side so AssemblyScript programmers can also drive our 3D web engine.

Here's our C++ tutorial : http://advance-software.com/develop/#tutorial

Would like to be able to do the same via AssemblyScript.

Our underlying is wasmtime, but I don't think that's relevant as AssemblyScript will not be binding to the host.

That said, I suppose it could to cut out jumping thru C++ to resolve. Open to this as a possible solution.

We don't yet support linking with C/C++ that's compiled to Wasm.

Then AssemblyScript is not as of time of writing an XSG 3D web compatible language.