Segfault when attempting to use VST3 plugin linked with other 3rd party libs

Writing a Windows VST3 plugin. I’m linking against some other 3rd-party libs: Google protobufs, Google RPC, and SuperpoweredSDK. Standalone app was working great, so I built the debug version of the .vst3. So far so good, it does load in the DAW.

But, as soon as I make any API call into any of the 3rd party libraries I’m using, the plugin segfaults. Memory seems to be completely corrupted, debugger is not giving me a backtrace when things die.

image

Could use some ideas to investigate. Current train of thought is maybe I’m doing something wrong when linking these libs into the dll or some sort of memory model issues? Tried to build with both /MD and /MT using the static and dynamic versions of the 3rd party libs, but that didn’t solve the issue.

I had similar issues because my plugin could not find the dynamically linked DLL, make sure that VST can see it.

I’m not dynamically linking to another dll, I’m linking in static lib files.

I’ve simplified this down to the easiest test case I can:

  • created a new empty VST3 plugin using ProJucer (this builds and loads correct)

  • edited the PluginProcessor.cpp file to add the following 2 lines at the top:

    #include “…/…/Superpowered_2.0.1/Superpowered.h”
    #pragma comment(lib, “…/…/Superpowered_2.0.1/libWindows/SuperpoweredWin142_Debug_MD_x64.lib”)

  • edited TestEmptyPluginAudioProcessor::TestEmptyPluginAudioProcessor() constructor to add a single new line:

    Superpowered::Initialize(“ExampleLicenseKey-WillExpire-OnNextUpdate”, true, false, true, false, true, false, false);

That’s it. With these changes, the plugin will crash when it is loaded in the JUCE AudioPluginHost.

The SuperpoweredSDK audio toolkit .lib file being linked in with that pragma is the one available from here: https://superpowered.com/audio-overview

Is there a place where I can upload a simple project to demonstrate this problem? I’ve tried linking 3 different libraries into the JUCE VST3 plugin, but in all cases the behaviour is the same – segfault when the DAW attempts to load the dll. Got a co-worker to build it on his machine with the same results. (But we’re both using VS2019, which makes me think maybe I should downgrade and try with an older version?)

I think linking libraries through a #pragma is a non-standard and not really cross-platform compatible way of linking a library – at least I’m not aware of widespread usage of this technique although MSVC++ seems to support it. However to make sure that this technique doesn’t generate any strange side-effects, have you tried linking the library the “old school” way through the appropriate fields in the Exporter Settings of the Projucer?

Yes, I tried both. My use of a #pragma here was to try and limit as much as I could the changes from a “standard” plugin (which works) to one that exhibited the crash behaviour.