Skip to main content
Plugdata allows you to compile custom Pure Data externals directly into the plugin, making them available in both plugin and standalone versions.

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: Called in Setup::initialisePdLua() (Source/Pd/Setup.cpp:1399-1402). Best for:
  • Standalone externals
  • No namespace prefix required
  • Independent objects
Example:

initialiseELSE

Called in Setup::initialiseELSE() (Source/Pd/Setup.cpp:1473). Note:
Externals registered here are available under both the plain name and else/ prefix:
  • [myexternal] ✅
  • [else/myexternal] ✅
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

Solution: Ensure setup function is declared in extern "C" block and definition matches exactly.

External Not Found

Solution: Verify setup function was called and class name matches object name.

Multiple Definition Errors

Solution: Check that source file isn’t added twice in CMakeLists.txt.

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