我在我正在编写的VST主机插件中加载VST插件时遇到问题 . 我已经成功加载了我发现的大多数插件,但似乎有一个给我奇怪的问题 . 我可以在adobe试听和使用JUCE框架的主机中加载它 .

当dlopen被调用时,我得到了这个错误,我似乎无法在互联网上找到类似的东西:

dlopen(/ Library / Audio / Plug-Ins / VST / Plugin Alliance / SPL De-Verb.vst / Contents / MacOS / SPL De-Verb,9):找不到合适的图像 . 找到:库/音频/插件/ VST /插件联盟/ SPL De-Verb.vst / Contents / MacOS / SPL De-Verb:格式错误的机器图像:__TEXT段映射文件的开头但是可写

在其上运行文件向我显示它是一个具有两种架构的通用二进制文件:

$ 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

这是插件的网站:https://www.plugin-alliance.com/en/products/spl_de-verb.html

这是我用来加载它的代码:

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;
}