bytecodealliance / lucet

Lucet, the Sandboxing WebAssembly Compiler.
Apache License 2.0
4.07k stars 164 forks source link

Is it possible to use lucet with C++ (as scripting engine)? #266

Open blockspacer opened 4 years ago

blockspacer commented 4 years ago

Use case: lucet as scripting engine for C++ server (uses boost for networking).

Issue: C++ server <-> Rust (lucet) as scripting engine <-> C++ (WASM)

jedisct1 commented 4 years ago

Hi,

The Lucet runtime has a C API. See the prototypes here: https://github.com/fastly/lucet/blob/master/lucet-runtime/include/lucet.h . The extern "C" guards are currently missing, but that can be easily added in order to make usage in C++ easier.

Now, Lucet currently works by compiling WebAssembly code ahead of time using lucetc. So it may not be a good fit as a scripting engine.

Can you clarify what you are trying to do?

blockspacer commented 4 years ago

I was trying to find lucet & C++ usage example.

I`ll try extern "C". Thanks for response.

jedisct1 commented 4 years ago

The documentation is indeed missing C/C++ usage examples.

This is something we absolutely need to improve, thanks for the heads up!