Above method and its brethren freeDynamicLibrary and getProcedureEntryPoint work on both MSW and Linux but not on Mac OS X.

I based a plugin model on them and I was wondering why they aren’t implemented on the Mac.

I’m not too familiar with OS X internals but I gather from the Bundle Programming Guide (Loading and Unloading Executable Code) that it could be implemented using a CFBundle objects for library handles - or would something more low-level be more appropriate?

The methods aren’t in the api docs (no DOXYGEN flag in the #if guard), are they supposed to be internal undocumented helpers for the plugin architecture?

The plugins I create are plain C++ with no Juce or Cocoa in them (the one I want to use on the Mac is a sqlite wrapper, I’ll probably do a wrapper for MySQL access as well).

Should I use the Juce plugin architecture (which I don’t understand, is there an overview somewhere in the docs?) for writing such stuff in a platform independent way, or must I learn special OS X magic to have my plugins work on the Mac?

I didn’t do it for mac because there were about 4 different ways of loading a dynamic library or bundle and none of them fitted very well into those functions. I’d be interested to see what you come up with though!

Turned out quite trivial - dlopen, dlsym and dlclose did the job for me.

The only difficulty was finding them in the Mac OS developer docs.

yes, (dlopen, dlsym and dlclose) for linux and Mac. STANDAR C (#include <dlfcn.h>)

my class for load Dynamic Library.

There’s still no code for this on Mac… I too successfully have used dlopen, dlsym & dlclose before. Jules ? :slight_smile:

OSX has at least two (three?) different mechanisms for opening a library or bundle, so it doesn’t really translate well into a single cross-platform call like that.

But… I’ve done it on Mac OS X with dlopen/dlsym + dlclose (on .dylib files) and it works fine… any problems doing that exactly ? I know that OS X has other mechanisms, but I remember ditching them in favor of dl because they’d only allow a very limited path length (something like 64 characters)…

Anyway, since I’ve implemented it already there’s no rush to include in Juce… :wink:


I’m using Juce’s Window-specific dynamic library loader, so if a Mac-specific version (+droid, ioS, linux, etc) appears in Juce I am not gonna complain!

Not since 10.4 if memory serves.