To create a language binding for a waPC guest module, there are a couple of steps you need to take. To create a host runtime, you’ll want to follow the examples in the wapc-go or wapc-rust repositories. Hosts must implement and expose the FFI functions, while guests must expose the guest-owned functions and consume those exposed by a host runtime.
Create a reusable guest library that all guest modules can use, including wasmcloud actors. Examples of guest libraries can be found in the following repositories:
Guest libraries must expose the
__guest_callfunction and consume all of the host’s functions in the appropriate sequence. You can also choose to provide a number of conveniences that might be idiomatic for your language of choice.
Add a language to the
widlcode generator here.
Add the appropriate language-specific templates here. The code generator for
widland the corresponding templates are used to create reusable communications libraries that can be shared between a capability provider and an actor. For wasmcloud, we have ours in the actor-interfaces repository.
The only difference between a waPC guest module and a wasmcloud actor is that actors are required to interpret and respond to a health request. You can see from the multiple actor-core libraries how you can upgrade a regular waPC module to a wasmcloud actor. You will need to implement a corresponding “actor core” library for your new language that allows actors to respond to the health request message.
You can find more details on
widl specification, and creating waPC language bindings at wapc.io.