Creating a waPC Language Binding

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.

  1. 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_call function 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.

  2. Add a language to the widl code generator here.

  3. Add the appropriate language-specific templates here. The code generator for widl and 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.

  4. 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, the widl specification, and creating waPC language bindings at wapc.io.