On Aug 23, 2010, at 12:20 PM, Sidney San Martín wrote:
> I'm developing for 10.4.11 and up, using -respondsToSelector: and
> NSClassFromString() to target different OSs at runtime, and it's gone
> super-smoothly so far.
> 
> I just ran into an issue I can't figure out on my own. When I link to
> the System Configuration framework and IOKit, and target 10.4, calling
> some SystemConfiguration framework functions crashes my application
> with "Symbol not found: _SCDynamicStoreCreate".
> 
> This happens if I use any base SDK newer than 10.4, which is a bad
> thing for this project.

This looks like a bug in the SDKs. I don't see the appropriate magic symbols 
that tell the linker the OS version when the function moved from IOKit to 
SystemConfiguration. You should file a bug report.

You can use dlsym() to work around the problem. Try something like this 
(warning: untested):

SCDynamicStoreRef MySCDynamicStoreCreate(... args ...) {
    static typeof(SCDynamicStoreCreate) fn = NULL;
    void *dl;

    if (!fn  &&  (dl = dlopen("SystemConfiguration.framework", RTLD_LAZY | 
RTLD_NOLOAD))) {
        fn = dlsym(dl, "SCDynamicStoreCreate");
        dlclose(dl);
    }
    if (!fn  &&  (dl = dlopen("IOKit.framework", RTLD_LAZY | RTLD_NOLOAD))) {
        fn = dlsym(dl, "SCDynamicStoreCreate");
        dlclose(dl);
    }
    if (!fn) {
        abort();
    }

    return (*fn)(... args ...);
}


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to