Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
- Subject: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
- From: Sidney San MartÃn <email@hidden>
- Date: Mon, 23 Aug 2010 15:20:24 -0400
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.
Here's a minimal test case, if you want to play along:
1. Create a new Foundation Command Line Tool project.
2. Link to IOKit.framework and SystemConfiguration.framework.
3. Set the project's deployment target to 10.4 and the base SDK to 10.5 or 10.6.
4. Put this in main.m:
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
int main (int argc, const char * argv[]) {
CFRelease(SCDynamicStoreCreate(NULL, (CFStringRef)@"testing",
NULL, NULL));
return 0;
}
5. Build and go!
On 10.5 and up, this works fine. If you run it on a 10.4 machine, it
crashes like this:
dyld: lazy symbol binding failed: Symbol not found: _SCDynamicStoreCreate
Referenced from: /Users/deeptech/./scds
Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
dyld: Symbol not found: _SCDynamicStoreCreate
Referenced from: /Users/deeptech/./scds
Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
If you don't link to IOKit, it should work.
Earlier this year, Steve Mykytyn ran into the same issue targeting
10.5 64-bit (<http://lists.apple.com/archives/cocoa-dev/2010/Mar/msg00695.html>),
but was able to solve it forcing the application to run in 32-bit mode
on 10.5. That doesn't work in this case.
Any ideas?
_______________________________________________
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