|
This blog article is great, I had a hell of a time integrating Wasm into Ruby, so much so to the point that I gave up. I was absolutely going to call a function, pass it some HTML to parse (as a string), and return a number, but what I wound up doing is pass a directory with some HTML file in it, return a number as a string, and parse it. Because after struggling with wasmtime and wasmer until I could see it was not going to perform acceptably with a Ruby interpreter packed into the Wasm module, I found that further, it was seemingly impossible to call a function from in Ruby with any meaningful parameters without going through the system interface to the Wasm. https://youtu.be/EsAuJmHYWgI?list=PLbzoR-pLrL6prBc8UnTQ9wI3B... and https://youtu.be/EsAuJmHYWgI?list=PLbzoR-pLrL6prBc8UnTQ9wI3B... The article does a much better job of explaining these issues concretely, but if you're totally lost, you can hear my fever-dream version of the same ideas here. (I am a Wasm beginner.) But if you don't have time to watch, tl;dr: I gave up, my Wasm in the end was called as a WASI, which I passed a filesystem context into rather than attempt to call any function at all, and I parsed the output from the system interface. Not too different than what it looks like the Extism example is doing. I will definitely be going through these docs as it seems likely to help me understand better what I've missed, and moreover that it has Ruby support right on the front page chef's kiss |
I added host function support and cleaned up the API a bit.