From e0713c5fe7da9d52268bcabf0ae90e14fd2e2345 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 26 Jun 2021 14:57:03 +0200 Subject: [PATCH] Define the deprecated VST<2.4 `main` entry point This should allow @AVLinux to use yabridge under EnergyXT. --- CHANGELOG.md | 3 +++ src/plugin/vst2-plugin.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e935088..0bf29f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ Versioning](https://semver.org/spec/v2.0.0.html). Linux plugin hosts. This should not be necessary in any normal situation since Desktop Linux has been 64-bit only for a while now, but it could be useful in some very specific situations. +- Defined the deprecated pre-VST2.4 `main` entry point for VST2 plugins. This + allows the above mentioned 32-bit version of yabridge to be used in EnergyXT, + allowing you to use both 32-bit and 64-bit Windows VST2 plugins there. ### Changed diff --git a/src/plugin/vst2-plugin.cpp b/src/plugin/vst2-plugin.cpp index fa6d9f0c..f858b55d 100644 --- a/src/plugin/vst2-plugin.cpp +++ b/src/plugin/vst2-plugin.cpp @@ -25,10 +25,9 @@ #define VST_EXPORT __attribute__((visibility("default"))) // The main entry point for VST2 plugins should be called `VSTPluginMain``. The -// other one exist for legacy reasons since some old hosts might still use them. -// There's also another possible legacy entry point just called `main`, but GCC -// will refuse to compile a function called `main` that's not a regular C++ main -// function. +// other one exist for legacy reasons since some old hosts might still use them +// (EnergyXT being the only known host on Linux that uses the `main` entry +// point). /** * The main VST2 plugin entry point. We first set up a bridge that connects to a @@ -61,6 +60,11 @@ extern "C" VST_EXPORT AEffect* VSTPluginMain( } } -extern "C" VST_EXPORT AEffect* main_plugin(audioMasterCallback audioMaster) { +// XXX: GCC doens't seem to have a clean way to let you define an arbitrary +// function called 'main'. Even JUCE does it this way, so it should be +// safe. +extern "C" VST_EXPORT AEffect* deprecated_main( + audioMasterCallback audioMaster) asm("main"); +VST_EXPORT AEffect* deprecated_main(audioMasterCallback audioMaster) { return VSTPluginMain(audioMaster); }