I have been working through parts of the component model ABI from a C++ hosts perspective on and off for the last year and finally got around to mocking up how it looks in a real world host example (using wamr, but should be equally agnostic for other runtimes).
Here is my first attempt at a "sample" for wamr (wit generating the stubs for a guest, with a hand coded wamr host):
Hopefully the usage pattern is self evident from the sample aboce and will lend itself to a future wit -> c++
host generator?
FYI the output for the example is:
and_func(0, 0): 0
and_func(0, 1): 0
and_func(1, 0): 0
and_func(1, 1): 1
add_func(3.1, 0.2): 3.3
reverse_string(Hello World!): !dlroW olleH
reverse_string(!dlroW olleH): Hello World!
reverse_tuple(0, Hello World!): !dlroW olleH, 1
list_filter_bool(2): 1
Last updated: Apr 11 2025 at 18:04 UTC