Building Plugins#
The SDK ships with build.bat, a build script that compiles C++ source files to WASM.
Basic Usage#
cd plugin-sdk
build.bat examples\my_plugin.cpp # Build one plugin
build.bat # Build all plugins in examples/
Built .wasm files are placed in the output/ directory.
Build Modes#
Standard Plugin Build#
Compiles with these flags:
| Flag | Purpose |
|---|---|
--target=wasm32 |
Compile to 32-bit WebAssembly |
-O2 |
Optimize for speed |
-std=c++17 |
C++17 standard |
-nostdlib |
No standard library (freestanding) |
-fno-exceptions |
No C++ exceptions |
-fno-rtti |
No runtime type information |
--no-entry |
No main() required |
--allow-undefined |
Allow unresolved imports (filled by host) |
The standard build exports these entry point symbols:
on_load,on_unload,on_frame,on_render,on_menu,on_hero_changed,on_get_info,on_perform_action
Library Build#
Library mode uses --export-all instead of exporting specific entry points. This makes every extern "C" function in your source available as a WASM export, which the host can then bridge to dependent plugins.
See the Dependencies guide for the full workflow.
Build All#
Builds every .cpp file in examples/ as a standard plugin. Library plugins must be built individually with --library.
Troubleshooting#
"Clang not found in PATH"#
Install LLVM/Clang and ensure it's in your system PATH. See Installation.
"undefined symbol" warnings#
These are normal for WASM imports. The --allow-undefined flag tells the linker to leave them unresolved — the Xenon host will provide them at runtime.
"multiple definition" errors#
You likely have two .cpp files with the same function name in the same build. Each plugin should be a single .cpp file.
Large output files#
If your .wasm file is unexpectedly large, make sure you're not accidentally including standard library headers. The SDK is freestanding — use only <xenon/SDK.hpp>.