foo.m:17: warning: 'NSLookupSymbolInImage' is deprecated (declared at /Developer/SDKs/MacOSX10.5.sdk/usr/include/mach-o/dyld.h:182)When I look into the header I find this:
/* * The following dyld API's are deprecated as of Mac OS X 10.5. They are either * no longer necessary or are superceeded by dlopen and friends inand. * dlopen/dlsym/dlclose have been available since Mac OS X 10.3 and work with * dylibs and bundles. * * NSAddImage -> dlopen * NSLookupSymbolInImage -> dlsym * NSCreateObjectFileImageFromFile -> dlopen * NSDestroyObjectFileImage -> dlclose * NSLinkModule -> not needed when dlopen used * NSUnLinkModule -> not needed when dlclose used * NSLookupSymbolInModule -> dlsym * _dyld_image_containing_address -> dladdr * NSLinkEditError -> dlerror * */
extern NSSymbol NSLookupSymbolInModule(NSModule module, const char* symbolName) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;So it appeared in 10.1 and it's plug gets pulled in 10.5. Short lived API, I would say.
What bothers me, that one of the ideas behind Foundation is, that it should isolate me from the OS layer and abstract to a common denominator, that remains stable. Yet here, the Foundation functions are deprecated and I am suposed to use dyld directly, although Foundation still could (and probably does) do the work using dyld.
I don't get this.
Comments (2)
These functions were not part of Foundation, to the best of my knowledge, even though they use the OpenStep name prefix. The NSModule API was only a wafer-thin shim over the Mach-O memory image format, and it was always part of dyld. Support for modern concepts (such as a per-library symbol namespace!) was poor, and the API could never support Apple's or Microsoft's older (in some ways superior) shared libary technologies. dlopen is a standard Unix API far more widely implemented than NSModule.
Posted by Massive Missive
|
January 7, 2010 8:32 AM
Posted on January 7, 2010 08:32
Yes. Looking at my code more carefully (inclusion of <mach-o/dyld.h>, I can see that I leapt to the conclusion that NSLookupSymbolInImage was part of Foundation, when it's technically not.
Nevertheless your comment tells me the history of the NSModule API, but still the question remains, was it correct to deprecate it ?
I would assume, that the idea of NS prefixed functions is to abstract and to remain stable. So even if some time in the future dyld dies, I'd expect there would/should be an effort to maintain its semantics. Otherwise why introduce it in the first place ?
Posted by Nat!
|
January 7, 2010 2:30 PM
Posted on January 7, 2010 14:30