views:

27

answers:

1

I have a Mac application that I must build against the Mac OS 10.4 SDK for various reasons beyond my control. Given that my application's minimum OS version will be 10.5. (I know, I know... but I can't give any more details than the above to justify why this is the case.)

Within the Mac OS 10.5 SDK is an API, FSMatchAliasBulk, for which I cannot find a good equivalent in the 10.4 SDK. Knowing that I will be running on Mac OS >= 10.5, how can I get access to the FSMatchAliasBulk at runtime?

+1  A: 

First, check out "How Cross-Development Works" in your Xcode Help by selecting "Developer Documentation" from the Xcode Help menu. In the documentation window, type "How Cross-Development Works" and hit return. There you will see more information.

And here is what I think you'll need to do: load the CoreServices framework and then get the function pointer for that function if you know that you're running on Mac OS X 10.5 (check out the Gestalt functionality to determine that).

Here is a sample that is not tested, but should lead you in the right direction:

CFBundleRef systemBundle = NULL;

short result = LoadFrameworkBundle(CFSTR("CoreServices.framework"), &systemBundle);

if (result == 0) {
 typedef OSStatus (FSMatchAliasBulkProcPtr) (const FSRef*, unsigned long, AliasHandle, short*, FSRef*, Boolean*, FSAliasFilterProcPtr, void*);

 FSMatchAliasBulkProcPtr myFSMatchAliasBulk = (FSMatchAliasBulkProcPtr) CFBundleGetFunctionPointerForName(systemBundle, CFSTR("FSMatchAliasBulk"));

 if (myFSMatchAliasBulk) {
 // call FSMatchAliasBulk
    OSStatus status = myFSMatchAliasBulk(....);
 }
 }
Lyndsey Ferguson
Perfect, thanks!
fbrereto