PLUG'N SCRIPT
rapid plugin development
Tutorial
DSP
KUIML
How-to
Scripts
  • Make a gain plugin
  • Make a simple low-cut filter
  • Add params more conveniently
  • Share data between instances
  • Compile native code
  • Miscellaneous
How-toCompile native code
December 17, 2025

How To Compile Native C++ Binaries

When porting your code from AngelScript (.cxx) to the Native C++ version (.cpp -> .bin/.x64/.x86), you need to compile the .cpp file into a binary file that Plug'n Script can load. While there are different approaches to Native C++ programming, you should begin by downloading and installing Xcode (for macOS) or Visual Studio (for Windows).

The compilation commands provided below are working examples. Feel free to modify them according to your needs. You can ask DeepSeek/ChatGPT/Gemini/etc to help explain compiler options, suggest improvements and experiment.

Alternatively, you can download ready-to-use project files for Xcode or Visual Studio from the Plug'n Script GitHub repository (check Built-in/NativeSource and NativeSource).

Compiling within Xcode or Visual Studio offers benefits such as integrated debugging, though the initial setup may appear more complex compared to directly compiling .cpp files into .bin. On the other hand, command-line compilation allows you to continue using your preferred editor (such as Sublime Text) without needing to switch to a full-featured IDE.

Mac

After installing XCode and Command Line Tools for XCode, you can compile your .cpp file from command line (or via shellscript) using something like this:

  1. clang++ -std=c++11 -bundle -arch arm64 -arch x86_64 -O1 -mmacosx-version-min=10.9 "SCRIPT_NAME.cpp" -o "SCRIPT_NAME.bin"

If you want to be more modern regarding C++ standards and OS support, use something like

  1. clang++ -std=c++20 -bundle -arch arm64 -arch x86_64 -O3 -mmacosx-version-min=10.15 "SCRIPT_NAME.cpp" -o "SCRIPT_NAME.bin"

After successful compilation, sign your binary with an Apple Developer Certificate to ensure it can run normally on other computers. This is essential if you plan to distribute your plugin commercially or to other macOS users.

  1. codesign -s "Developer ID Application: Your Name (XXXXXXXX)" "SCRIPT_NAME.bin"

Windows

To compile 64 bit .dll from your .cpp you can do something like this:

  1. // select 64-bit configuration
  2. "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
  3.  
  4. // compile .dll from .cpp
  5. cl /LD /MD /std:c++17 /Zi /EHsc /nologo /D "WIN32" /D "_USRDLL" /D "DEBUG" /Fe"SCRIPT_NAME.x64" "SCRIPT_NAME.cpp"

If you additionally want to compile 32 bit version, change "vcvars64.bat" to "vcvars32.bat" in the first call, and name compiled file with .x86 extension (instead of .x64). Notice, that users with 32-bit OS are rare these days.

During compilation several additional files (.obj, .lib, .exp, .ilk, .pdb) are created. They can be deleted to keep things clean (leave .pdb if you debug).

  1. del "SCRIPT_PATH\*.obj"
  2. del "SCRIPT_PATH\*.lib"
  3. del "SCRIPT_PATH\*.exp"
  4. del "SCRIPT_PATH\*.ilk"
  5. del "SCRIPT_PATH\*.pdb" // you may need .pdb for debugging

Additional information

See the official Native Programming Tutorial for complete details. 


Comments

Please, authorize to view and post comments.

2020 - 2026 © Site by LetiMix · Donate  |  Plug'n Script and KUIML by Blue Cat Audio