examples icon indicating copy to clipboard operation
examples copied to clipboard

No example that demonstrates binding to C/C++

Open adv-sw opened this issue 1 year ago • 3 comments

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.

adv-sw avatar Mar 24 '24 12:03 adv-sw

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 avatar Mar 24 '24 15:03 CountBleck

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.

CountBleck avatar Mar 24 '24 15:03 CountBleck

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.

adv-sw avatar Mar 25 '24 10:03 adv-sw