I'm trying to do the same thing. So far, I've found (just through
research, not actually trying to do it) that it is possible to use the
gcc dlopen, dlsym, dlclose functions by including dlfcn.h. However,
Macintosh suggests that you use its newer functions from the Mach-O
SDK - NSLoadImageFileFromFile, NSLinkModule, etc. located in the
header <mach-o/dyld.h>. I've found sample source that does this, so I
tried it myself. However, as I posted a few days ago, I am getting
"illegal bitfield" errors within the file loader.h, also included by
dyld.h. Maybe there is a setting I'm supposed to look for, or some
#define I should declare.
Also, the documentation on these functions talks about only loading
filed linked with the -bundle option. Does that mean I have to
compile my library as a bundle instead of a dynamic library? Not sure
how to proceed.