Stream: general

Topic: ✔ provide external functions to runtime


view this post on Zulip Stepan Parunashvili (Oct 06 2022 at 23:00):

Hey team,

I'm working on a successor to Firebase, and was thinking of using wastime as a way to let users write code for permissions.

This is a noob question, but is there a way to provide "external functions" to wasmtime?

i.e say my server is on the JVM, and users write permissions in assemblyscript. If a user writes:

var foo = query("SELECT * FROM users")

Could I provide a function written in my host language, which gets called with the arguments of query, and returns the result?

view this post on Zulip Ramon Klass (Oct 06 2022 at 23:29):

yes you can, see component model for more information (also wit-bindgen)

webassembly by itself allows exporting and importing foreign functions, but the only data types are 32 and 64 bit integers and floats

webassembly interface types let you specify higher order functions and wit-bindgen can autogenerate host and guest code that transparently convert the parameters and return value

https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md

Repository for design and specification of the Component Model - component-model/WIT.md at main · WebAssembly/component-model

view this post on Zulip Notification Bot (Oct 08 2022 at 21:52):

Stepan Parunashvili has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC