Re: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
Re: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
- Subject: Re: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
- From: Greg Parker <email@hidden>
- Date: Mon, 23 Aug 2010 12:46:57 -0700
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 email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden