[I'm resending this, since it seems not to have gone through the first time RP] Bernie wrote: > I don't have a problem creating a CFDictionary, where the key/value > pairs are both CFStrings but there's something I'm not quite > grasping when the value is stored in the dictionary as a CFNumber. > I thought that once the number had been created and stuffed into > the dictionary we could release the CFNumber. All the examples I've > looked at on the developer site appear to do it that way. > > This bit of code creates a CFDictionary with two key/value pairs, > "Key1", 123 and "Key2", 456 then reads them back. If I uncomment > one of the CFRelease( numberRef ) lines, weird things happen. Any > ideas where I'm going wrong? Provide a CFDictionaryValueCallBacks parameter to CFDictionaryCreateMutable, so that the dictionary can retain values. The one you want is defined in the C headers as: CF_EXPORT const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; To access this from FB, get it from CoreFoundation.framework with CFBundleGetDataPointerForName. toolbox fn CFBundleGetDataPointerForName( CFBundleRef bundle, ¬ CFStringRef symbolName ) = pointer begin globals dim as CFBundleRef gCoreFoundationBndl end globals long if ( gCoreFoundationBndl == 0 ) gCoreFoundationBndl = fn CreateBundleForFramework ( "CoreFoundation.framework" ) end if dim as pointer valueCallBacks // data pointer from bundle and name valueCallBacks = fn CFBundleGetDataPointerForName ( gCoreFoundationBndl, fn CFSTR( "kCFTypeDictionaryValueCallBacks" ) ) dict = fn CFDictionaryCreateMutable( 0, 0, 0, valueCallBacks ) Robert P.