Link error building 64bit plugin host demo on mac

Hello,

I grabbed the most recent version of the tip as of Monday of this week, and am attempting to build a 64 bit version of the audio plugin host demo application on Mac OS 10.6. I’m able to compile a 32 bit version no problem, but when I compile a 64 bit version I get two link errors:

Undefined symbols:
  "juce::VSTPluginFormat::VSTPluginFormat()", referenced from:
      juce::AudioPluginFormatManager::addDefaultFormats()      in JuceLibraryCode2.o
  "typeinfo for juce::VSTPluginFormat", referenced from:
      juce::AudioPluginFormatManager::addDefaultFormats()      in JuceLibraryCode2.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

From looking at the source code it looks like the implementations in the VSTPluginFormat class are #ifdef’d out when compiling in 64 bit on Mac (see juce_VSTPluginFormat.cpp line 62), but the AudioPluginFormatManager tries to instantiate it regardless of which architecture you are compiling. If I change juce_AudioPluginFormatManager::addDefaultFormats( ) like this:

[code]#ifdef JUCE_DEBUG
// you should only call this method once!
for (int i = formats.size(); --i >= 0;)
{
#if JUCE_PLUGINHOST_VST && !(JUCE_MAC && JUCE_64BIT)
jassert (dynamic_cast <VSTPluginFormat*> (formats[i]) == 0);
#endif

…snip…

#if JUCE_PLUGINHOST_VST && !(JUCE_MAC && JUCE_64BIT)
formats.add (new VSTPluginFormat());
#endif

…snip…
#endif
[/code]

I’m able to compile and link without errors. Am I missing a configuration step that would allow me to build and link without adding the extra guards in AudioPluginFormatManager?

Thanks in advance for any insight.

Well, VST isn’t supported in a 64-bit build, so it’s not surprising it’d fail to build. That’s a pretty good suggestion though, I’ll add something along those lines, thanks!

Sure. Glad to help. To clarify, 64 bit VST is not supported on Mac or Windows, correct? I’m running into a similar situation compiling a 64 bit build in Visual Studio 2008 with VST hosting enabled.

AFAIK 64-bit isn’t officially supported in VST2.x

That is the official statement from the Steinberg website:
http://www.steinberg.net/index.php?id=334&L=1

So it should be possible to build 64bit VST 2.4 plugins, both on Mac and Windows.

On windows it is working Ok

I wanted to update this thread with some more info regarding the issues I ran into compiling a 64 bit version of the JUCE library on Windows with VST hosting enabled. I got several identical compiler errors in juce_VSTPluginFormat.cpp:

The problem is that GWL_WNDPROC is not defined for a 64 bit compile (see WinUser.h line 1662)

To get rid of the compile errors I changed the Get/SetWindowLongPtr calls in juce_VSTPluginFormat.cpp file to use GWLP_WNDPROC, which is defined for 32 bit and 64 bit apps. This was the recommended approach in a Microsoft doc I found online:

http://msdn.microsoft.com/en-us/library/ms717063%28VS.85%29.aspx

Thanks - I already used the 64-bit version of those constants in other code, I must have forgotten to update the ones in the VST stuff. Will sort that out!

Hi Jules,

It looks there is still one leftover GWL_WNDPROC that did not get updated to a GWLP_WNDPROC. In the latest tip juce_VSTPluginFormat.cpp line 1459:

Aha! Thanks for spotting that!