Implementing a c++ unofficial SDK

Before I start manually translating parts of compute-at-edge.witx into c++, I happend to noticie that the fastly-javascript project seems to leverage a more modern variant fastly.wit.

So I am able to create both a raw wasm and a wasm component from the fastly.wit, but I just get unresolved imports when I try and serve it…

It feels like I am missing one layer or setting an abi version somewhere which would let me leverage the fastly.wit?

compute-at-edge.witx describes the wasm ABI available on compute@edge. The fastly.wit interface is an optional target for the javascript sdk, but we don’t yet support the wit interface in production compute@edge - there is a prototype implementation over in viceroy if you are interested in peeking, but that is the only place it runs right now. When using the JS sdk for production compute@edge, the fastly.wit described interfaces are implemented (at the C linking stage) to use compute-at-edge.witx for its wasm import functions. You can reuse that code if you would like, but we aren’t committing to fastly.wit compatibility in the future, and expect it to change a bunch to incorporate in-progress wasi interfaces.

We can’t yet make any promises on when components & wit interfaces are available on compute@edge, but a bunch of us are working hard on it, so stay tuned!

1 Like

Thanks for the reply - I would be v. interested in looking at / reusing the thunking code you mentioned, is it tucked away in one of the online projects?

it is split between the https://github.com/fastly/js-compute-runtime/tree/main/runtime/js-compute-runtime/fastly-world and https://github.com/fastly/js-compute-runtime/tree/main/runtime/js-compute-runtime/host_interface directories, where the latter is a more c++ish abstraction over the api presented by the wit-bindgen generated c api

3 Likes