{"id":18462667,"url":"https://github.com/extism/cpp-pdk","last_synced_at":"2026-02-03T18:35:15.036Z","repository":{"id":254457417,"uuid":"842217485","full_name":"extism/cpp-pdk","owner":"extism","description":"Extism Plug-in Development Kit (PDK) for C++","archived":false,"fork":false,"pushed_at":"2024-12-12T23:56:53.000Z","size":50,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-15T19:54:21.159Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T23:04:54.000Z","updated_at":"2024-12-12T23:51:51.000Z","dependencies_parsed_at":"2024-12-13T00:32:33.464Z","dependency_job_id":null,"html_url":"https://github.com/extism/cpp-pdk","commit_stats":null,"previous_names":["extism/cpp-pdk"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/extism/cpp-pdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fcpp-pdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fcpp-pdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fcpp-pdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fcpp-pdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extism","download_url":"https://codeload.github.com/extism/cpp-pdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fcpp-pdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29052635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T09:03:57.827Z","updated_at":"2026-02-03T18:35:15.016Z","avatar_url":"https://github.com/extism.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extism C++ PDK\n\nBuild [Extism Plug-ins](https://extism.org/docs/concepts/plug-in) in C++.\n\n## Installation\n\nThe Extism C++ PDK is a single header library. Copy\n[extism-pdk.hpp](https://github.com/extism/cpp-pdk/blob/main/extism-pdk.hpp)\ninto your project or add this repo as a Git submodule:\n\n```shell\ngit submodule add https://github.com/extism/cpp-pdk extism-cpp-pdk\n```\n\nThe [wasi-sdk](https://github.com/WebAssembly/wasi-sdk/releases) is required to\nbuild, extract or install it and point the `WASI_SDK_PATH` environment variable\nat it.\n\n## Getting Started\n\nTODO\n\n## Building\n\nAs the C++ pdk is implemented as single header library, in **ONE** source file:\n\n```c++\n#define EXTISM_CPP_IMPLEMENTATION\n#include \"extism-pdk.hpp\"\n```\n\nIn other source files, just `#include \"extism-pdk.hpp\"`\n\nCompile:\n\n`$(WASI_SDK_PATH)/bin/clang++ -std=c++23 -fno-exceptions -O2 -g -o count-vowels.wasm count-vowels.cpp -mexec-model=reactor`\n\n- `-fno-exceptions` is needed as the Wasm doesn't have support for exceptions\n  yet.\n\n- `wasi-sdk-24.0` or later should be used as `-std=c++23` is required by the\n  pdk.\n\n- `-mexec-model=reactor` as we're building a\n  [reactor](https://dylibso.com/blog/wasi-command-reactor/) module - exporting\n  functions, not building a\n  [command](https://dylibso.com/blog/wasi-command-reactor/) program.\n\n## Generating Bindings\n\nIt's often very useful to define a schema to describe the function signatures\nand types you want to use between Extism SDK and PDK languages.\n\n[XTP Bindgen](https://github.com/dylibso/xtp-bindgen) is an open source\nframework to generate PDK bindings for Extism plug-ins. It's used by the\n[XTP Platform](https://www.getxtp.com/), but can be used outside of the platform\nto define any Extism compatible plug-in system.\n\n### 1. Install the `xtp` CLI.\n\nSee installation instructions\n[here](https://docs.xtp.dylibso.com/docs/cli#installation).\n\n### 2. Create a schema using our OpenAPI-inspired IDL:\n\n```yaml\nversion: v1-draft\nexports: \n  CountVowels:\n      input: \n          type: string\n          contentType: text/plain; charset=utf-8\n      output:\n          $ref: \"#/components/schemas/VowelReport\"\n          contentType: application/json\n# components.schemas defined in example-schema.yaml...\n```\n\n\u003e See an example in [example-schema.yaml](./example-schema.yaml), or a full\n\u003e \"kitchen sink\" example on\n\u003e [the docs page](https://docs.xtp.dylibso.com/docs/concepts/xtp-schema/).\n\n### 3. Generate bindings to use from your plugins:\n\n```\nxtp plugin init --schema-file ./example-schema.yaml\n    1. TypeScript                      \n    2. Go                              \n    3. Rust                            \n    4. Python                          \n    5. C#                              \n    6. Zig                             \n  \u003e 7. C++                             \n    8. GitHub Template                 \n    9. Local Template\n```\n\nThis will create an entire boilerplate plugin project for you to get started\nwith:\n\n```cpp\n// returns VowelReport (The result of counting vowels on the Vowels input.)\nstd::expected\u003cpdk::VowelReport, pdk::Error\u003e\nimpl::CountVowels(std::string \u0026\u0026input) {\n  return std::unexpected(pdk::Error::not_implemented);\n}\n```\n\nImplement the empty function(s), and run `xtp plugin build` to compile your\nplugin.\n\n\u003e For more information about XTP Bindgen, see the\n\u003e [dylibso/xtp-bindgen](https://github.com/dylibso/xtp-bindgen) repository and\n\u003e the official\n\u003e [XTP Schema documentation](https://docs.xtp.dylibso.com/docs/concepts/xtp-schema).\n\n## Reach Out!\n\nHave a question or just want to drop in and say hi?\n[Hop on the Discord](https://extism.org/discord)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextism%2Fcpp-pdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextism%2Fcpp-pdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextism%2Fcpp-pdk/lists"}