Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SystemConfiguration framework and Carbon CFM - continued



At 19:17 +0400 22/6/05, Igor Garnov wrote:
Where did I go wrong?

Did you do anything special to the function pointer that you supply when you register the callback associated with the runloop source. You will need to. SCF expects the callback to be a Mach-O-style callback (a pointer to code), which CFM function pointers aren't (they're a pointer to a TVector). Check out the CFM_MachO_CFM sample on our web site for the standard technique for handling this.


<http://developer.apple.com/samplecode/CFM_MachO_CFM/CFM_MachO_CFM.html>

Meanwhile, when it comes to variables residing in SCF, I do the following - is this right?

if ( bJaguarAndLater )
{
_kSCDynamicStoreDomainState = ( CFStringRef )CFBundleGetDataPointerForName( cfBundle, CFSTR( "kSCDynamicStoreDomainState" ) );
_kSCCompAnyRegex = ( CFStringRef )CFBundleGetDataPointerForName( cfBundle, CFSTR( "kSCCompAnyRegex" ) );
_kSCEntNetIPv4 = ( CFStringRef )CFBundleGetDataPointerForName( cfBundle, CFSTR( "kSCEntNetIPv4" ) );
}
else
{
_kSCDynamicStoreDomainState = CFSTR( "State:" );
_kSCCompAnyRegex = CFSTR( "[^/]+" );
_kSCEntNetIPv4 = CFSTR( "IPv4" );
}

As a rule I recommend that you don't test version numbers. Rather, just get the pointer and, if it's NULL, replace it with a constant string. For example:


_kSCDynamicStoreDomainState = ( CFStringRef )CFBundleGetDataPointerForName( cfBundle, CFSTR( "kSCDynamicStoreDomainState" ) );
if (_kSCDynamicStoreDomainState == NULL) {
_kSCDynamicStoreDomainState = CFSTR( "State:" );
}


S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden
References: 
 >SystemConfiguration framework and Carbon CFM - continued (From: Igor Garnov <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.