Pumpkin Plugin API for C/C++
Go to file
Demetrius Kanios 9a5e0b0f87 Fix everything
2026-07-20 22:37:34 -07:00
example Fix everything 2026-07-20 22:37:34 -07:00
wit@2aacac1f07 Fix everything 2026-07-20 22:37:34 -07:00
.gitignore Fix everything 2026-07-20 22:37:34 -07:00
.gitmodules Fix everything 2026-07-20 22:37:34 -07:00
Makefile Fix everything 2026-07-20 22:37:34 -07:00
pumpkin_api.c Fix everything 2026-07-20 22:37:34 -07:00
pumpkin_api.h Fix everything 2026-07-20 22:37:34 -07:00
README.md first commit 2026-04-15 20:08:21 +02:00

Pumpkin Plugin API for C

This package provides everything needed to write a Pumpkin server plugin compiled to WebAssembly using C or C++.

Quick start

  1. Clone this repository with submodules:
git clone --recursive <url-to-this-repo>
# Or if you already cloned it:
git submodule update --init --recursive
  1. Create your plugin (main.c):
#include "pumpkin_api.h"
#include <stdio.h>

pumpkin_metadata_t get_meta(void) {
    static const char* authors[] = {"you"};
    return (pumpkin_metadata_t) {
        .name = "my-c-plugin",
        .version = "0.1.0",
        .authors = authors,
        .authors_count = 1,
        .description = "A simple C plugin for Pumpkin",
        .dependencies_count = 0
    };
}

void on_load(plugin_own_context_t ctx) {
    printf("C plugin loaded!\n");
}

REGISTER_PUMPKIN_PLUGIN(((pumpkin_plugin_t){
    .get_metadata = get_meta,
    .on_load = on_load
}))
  1. Build your plugin into a WebAssembly component:

To build for Pumpkin, you'll need the wasi-sdk and wit-bindgen.

# Compile to Wasm using wasi-sdk
/path/to/wasi-sdk/bin/clang -O3 \
    -Iinclude -Isrc/gen \
    src/gen/plugin.c src/pumpkin_api.c example/main.c \
    -o my_plugin.wasm \
    -mexec-model=reactor