-
Please, help me see how to get this idea through with extism (all of this is fictional, only meant to serve as an example of how to build a real system with extism): Let's imagine we have a board we sell to our clients. That's the host for extism. Assume our host is an Arduino-like environment. So, the host calls extism via its C-interface. The board has several sensors (temperature, humidity, amount of CO2 on the air, ....). In this fictional system, we want:
But, providing all sensor data every time is time-consuming and can be difficult to extend later (what if there is a new sensor? or a sensor which is plugabble so might not be connected right now?). The ideal scenario would be for the plug-in to call for these resources, as needed. If you want to read current temperature, the plug-in should call the function As far as I can see, there is no way to do that. How can the Host expose a resource (a function, or additional data) to the plug-in? And you might say "expose a dynamic object (json) so additional values can be added in the future and optional sensors can be null when not enabled". Allow me to add some points to this:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
I believe what you are talking about is importing functions from the host. You can do this with webassembly. We have to do it to get all of this to work. However I don't know if we've made it ergonomic for our users yet. Let me get the team to chime in.
Btw, we do provide host functions for saving state we call them |
Beta Was this translation helpful? Give feedback.
-
Right now there's no way to expose functions from the host to a plugin. It's something we've discussed and are looking into for the Rust SDK, but it seems unlikely that we will have a generic way of doing this that works across all the supported SDK languages. |
Beta Was this translation helpful? Give feedback.
-
It seems that we cannot use a handler(or callback) as input of a plugin function. The exposed host function can be used as global handler for now. |
Beta Was this translation helpful? Give feedback.
-
As of v0.2.0, Host Functions are now available in several SDKs. See the overview here, and the examples for supported SDKs linked from within: |
Beta Was this translation helpful? Give feedback.
Right now there's no way to expose functions from the host to a plugin. It's something we've discussed and are looking into for the Rust SDK, but it seems unlikely that we will have a generic way of doing this that works across all the supported SDK languages.