You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the above configuration, any imports configured by wasmtime_wasi would work correctly, but any other imports would simply trap when invoked.
Benefit
This would provide users a simple way to get the linker to be happy and turn instantiation errors into runtime errors. This can be useful in cases where you want to instantiate a component and call one of its exports, and you are fine with calls to certain imports to simply trap if they occur.
Implementation
The implementation should be fairly straight forward I believe through the use of Component::env_component to do the necessary reflection to know when to call LinkerInstance::func_new with a closure that calls panic!("stubbed function called").
Future possibilities
In the future, we could expose an additional API that would allow the user to supply a closure that is invoked on each import invocation so that the user can customize the behavior of the stub.
The text was updated successfully, but these errors were encountered:
Feature
Several times I've simply wanted the linker to stub out all implementations for a component that it has not yet seen.
Essentially I've wanted to do roughly the following:
With the above configuration, any imports configured by
wasmtime_wasi
would work correctly, but any other imports would simply trap when invoked.Benefit
This would provide users a simple way to get the linker to be happy and turn instantiation errors into runtime errors. This can be useful in cases where you want to instantiate a component and call one of its exports, and you are fine with calls to certain imports to simply trap if they occur.
Implementation
The implementation should be fairly straight forward I believe through the use of
Component::env_component
to do the necessary reflection to know when to callLinkerInstance::func_new
with a closure that callspanic!("stubbed function called")
.Future possibilities
In the future, we could expose an additional API that would allow the user to supply a closure that is invoked on each import invocation so that the user can customize the behavior of the stub.
The text was updated successfully, but these errors were encountered: