Skip to content

Docs around using import_fn andhost_fn #26

@fliepeltje

Description

@fliepeltje

As I understand it, you use import_fn to defer some operation from a plugin to the host by means of defining a host_fn, but I cannot seem to get this to work - I'd love to experiment a bit more with this and I'd really appreciate some docs or an example that combines the use of import_fn and host_fn - the way I imagine this to work:

plugin code:

import extism

@extism.import_fn("app", "some_host_op")
def some_host_op(): ...

@extism.plugin_fn
def some_fn():
    some_host_op()

app code:

import extism

@extism.host_fn
def some_host_op():
    print("...")

manifest = ...
with extism.Plugin(manifest, wasi=True) as plugin:
    plugin.call("some_fn", "")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions