Re: SystemConfiguration framework and Carbon CFM - continued
Re: SystemConfiguration framework and Carbon CFM - continued
- Subject: Re: SystemConfiguration framework and Carbon CFM - continued
- From: Quinn <email@hidden>
- Date: Wed, 22 Jun 2005 17:39:18 +0100
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:
This email sent to email@hidden