Skip to content

Commit

Permalink
Define the deprecated VST<2.4 main entry point
Browse files Browse the repository at this point in the history
This should allow @AVLinux to use yabridge under EnergyXT.
  • Loading branch information
robbert-vdh committed Jun 26, 2021
1 parent e736600 commit e0713c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
14 changes: 9 additions & 5 deletions src/plugin/vst2-plugin.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

0 comments on commit e0713c5

Please sign in to comment.