I'm having an issue loading a VST plugin in a VST host plugin that I'm writing. I've been successful loading most plugins that I've found but there seems to be one that is giving me weird issues. I can load it in adobe audition and in hosts that use the JUCE framework.
When dlopen is called I get this error, and I couldn't seem to find anything similar on the internet:
dlopen(/Library/Audio/Plug-Ins/VST/Plugin Alliance/SPL De-Verb.vst/Contents/MacOS/SPL De-Verb, 9): no suitable image found. Did find: Library/Audio/Plug-Ins/VST/Plugin Alliance/SPL De-Verb.vst/Contents/MacOS/SPL De-Verb: malformed mach-o image: __TEXT segment maps start of file but is writable
Running file on it shows me that it is a universal binary with two architectures:
$ file ./SPL\ De-Verb
SPL De-Verb: Mach-O universal binary with 2 architectures: [i386: Mach-O bundle i386] [x86_64]
SPL De-Verb (for architecture i386): Mach-O bundle i386
SPL De-Verb (for architecture x86_64): Mach-O 64-bit bundle x86_64
Here is the site for the plugin: https://www.plugin-alliance.com/en/products/spl_de-verb.html
Here is the code I'm using to load it:
AEffect* newEffect = NULL;
// Create a path to the bundle
CFStringRef pluginPathStringRef = CFStringCreateWithCString(NULL,
pluginPath.c_str(), kCFStringEncodingUTF8);
CFURLRef bundleUrl = CFURLCreateWithFileSystemPath
(kCFAllocatorDefault, pluginPathStringRef,
kCFURLPOSIXPathStyle, true);
if (bundleUrl == NULL)
{
blog(LOG_WARNING, "Couldn't make URL reference for VST plug-in");
return NULL;
}
// Open the bundle
bundle = CFBundleCreate(kCFAllocatorDefault, bundleUrl);
if (bundle == NULL)
{
blog(LOG_WARNING, "Couldn't create VST bundle reference.");
CFRelease(pluginPathStringRef);
CFRelease(bundleUrl);
return NULL;
}
vstPluginMain mainEntryPoint = NULL;
mainEntryPoint = (vstPluginMain) CFBundleGetFunctionPointerForName
(bundle, CFSTR("VSTPluginMain"));
// VST plugins previous to the 2.4 SDK used main_macho for the
// entry point name.
if (mainEntryPoint == NULL)
{
mainEntryPoint = (vstPluginMain)
CFBundleGetFunctionPointerForName(bundle,
CFSTR("main_macho"));
}
if (mainEntryPoint == NULL)
{
blog(LOG_WARNING, "Couldn't get a pointer to plug-in's main()");
CFBundleUnloadExecutable(bundle);
CFRelease(bundle);
return NULL;
}
newEffect = mainEntryPoint(hostCallback_static);
if (newEffect == NULL)
{
blog(LOG_WARNING, "VST Plug-in's main() returns null.");
CFBundleUnloadExecutable(bundle);
CFRelease(bundle);
return NULL;
}