Overview
Unlike traditional Pure Data where externals are loaded as shared libraries, plugdata statically compiles externals into the application. This ensures:- ✅ Externals work in plugin hosts (DAWs)
- ✅ No external file dependencies
- ✅ Consistent behavior across platforms
- ✅ Better performance and security
Quick Start
Setup Function Locations
Choose where to call your setup function based on desired namespace:libpd_init_pdlua (Recommended)
Called inSetup::initialisePdLua() (Source/Pd/Setup.cpp:1399-1402).
Best for:
- Standalone externals
- No namespace prefix required
- Independent objects
initialiseELSE
Called inSetup::initialiseELSE() (Source/Pd/Setup.cpp:1473).
Note:
Example:
initialiseCyclone
Similar to ELSE, but for Cyclone compatibility. Note: Externals available as[myexternal] and [cyclone/myexternal].
Complete Example
Let’s add a simple gain external:Multi-File Externals
For externals with multiple source files:Libraries/CMakeLists.txt
Including Headers
For externals needing additional headers:Libraries/CMakeLists.txt
Platform-Specific Code
Use preprocessor directives for platform-specific code:Common Issues
Undefined Reference Errors
extern "C" block and definition matches exactly.
External Not Found
Multiple Definition Errors
Code References
Key files for adding externals:- External targets: Libraries/CMakeLists.txt:453-454
- ELSE auto-compilation: Libraries/CMakeLists.txt:215-241
- Setup declarations: Source/Pd/Setup.cpp:159-1321
- initialiseELSE: Source/Pd/Setup.cpp:1473-1829
- initialisePdLua: Source/Pd/Setup.cpp:1399-1402
Next Steps
Building from Source
Learn the complete build process
Lua Scripting
Create externals using Lua scripting
