Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 1.4 KB

README.md

File metadata and controls

42 lines (24 loc) · 1.4 KB

Extism C++ PDK

Build Extism Plug-ins in C++.

Installation

The Extism C++ PDK is a single header library. Copy extism-pdk.hpp into your project or add this repo as a Git submodule:

git submodule add https://github.com/extism/cpp-pdk extism-cpp-pdk

The wasi-sdk is required to build, extract or install it and point the WASI_SDK_PATH environment variable at it.

Getting Started

TODO

Building

As the C++ pdk is implemented as single header library, in ONE source file:

#define EXTISM_CPP_IMPLEMENTATION
#include "extism-pdk.hpp"

In other source files, just #include "extism-pdk.hpp"

Compile:

$(WASI_SDK_PATH)/bin/clang++ -std=c++23 -fno-exceptions -O2 -g -o count-vowels.wasm count-vowels.cpp -mexec-model=reactor

  • -fno-exceptions is needed as the Wasm doesn't have support for exceptions yet.

  • wasi-sdk-24.0 or later should be used as -std=c++23 is required by the pdk.

  • -mexec-model=reactor as we're building a reactor module - exporting functions, not building a command program.

Reach Out!

Have a question or just want to drop in and say hi? Hop on the Discord!