LoadLibrary / CFBundleLoadExecutable (VST Hosting)

Hi Jules,

I’m writing some basic stuff for a VST host.

Question is simple: do u know how if is possible to load a library and get entry point for a function (from a dll in Win32, from a bundle in mac I guess) in a portable manner with JUCE?.

I mean, tried to use the following code (part of VSTSDK2.4 ‘minihost’):


// win 32 load library

CFStringRef fileNameString = CFStringCreateWithCString (NULL, fileName, kCFStringEncodingUTF8);

	return false;

CFURLRef url=CFURLCreateWithFileSystemPath(NULL,fileNameString,kCFURLPOSIXPathStyle,false);

	return false;


if(module && CFBundleLoadExecutable((CFBundleRef)module)==false)
	return false;

But as soon as I include “windows.h” at top of my cpp file, I get a lot of errors (looks like include windows.h along JUCE is not possible).

Any alternative?

A crossplatform library loader would be nice.

Thanks for your time.

Just make sure you include juce.h after windows.h and it’ll be fine.

A cross-platform loader’s tricky because loading a VST requires various hacks, and it’s not really generic enough to go into the library.

You can’t do it with JUCE and its not trivial on the Mac but you can find a working code here (Mach-o plugins only, not CFM):


download source code for version 1.1 and its all there