Charles Davis cdavis@mymail.mines.edu writes:
You can. The "proper" way to do this is to use the CFBundle API. First you need to find the framework. Typically, it's in /System/Library/Frameworks, but the user might have a custom OpenAL in /Library/Frameworks or in $HOME/Library/Frameworks. Then we tack on the name of the framework we want, and create a CFURL object with the finished path. We can pass this to CFBundleCreate() to get a bundle object back. Then, we can use CFBundleLoadExecutable() to load the bundle into memory. You can use CFBundleGetFunctionPointerForName() and CFBundleGetFunctionPointersForNames() to extract function pointers from the bundle, and when you're done with it, you can use CFBundleUnloadExecutable(), followed by a CFRelease(), to close the bundle.
The other way to do this is to use wine_dlopen() on the framework executable, which is typically a file with the same name as the framework in the framework directory (so, for OpenAL, it would be a file named "OpenAL" in the "OpenAL.framework" directory). Then we can just use wine_dlsym() to extract function pointers like any other dynamic library. You still have to find the framework, though, which again is usually in one of the standard directories.
If you want, I can write you some functions that will do all this for you.
The point is to be able to use the same code on all platforms. If we have to replicate the loader implementation by hand then we don't gain anything, it will still be a mess of MacOS-specific ifdefs.