I've searched everywhere I can think of, but I'm not finding much help on
how to design Cocoa frameworks for Leopard that support both retain/release
and garbage collection. Can anybody supply a good link apart from the Apple
documentation?

Here's a specific question: My frameworks contain classes that declare
instance variables derived from CFType. For example, CGEventRef and
AXUIElementRef. In reading the "Instance variables" topic in the "Core
Foundation Variables" section of the "Garbage Collection Programming Guide,"
I see the statement, "If you declare a Core Foundation structure as an
instance variable, the compiler regards it only as an opaque structure
pointer, not as an object.... To indicate that a Core Foundation structure
should be treated as a collectable object, you use the __strong keyword."

The example given declares a CFType-derived object as an instance variable
in the interface part of a class like this:

   __strong CFDateRef myDate;

So, I guess my frameworks should declare ...

   __strong CGEventRef myEvent;
   __strong AXUIElementRef myUIElement;

... if I am going to advertise the frameworks as supporting both
retain/release and garbage collection. Is that right?

It's not that the documentation cited above is ambiguous. It's just that I
feel very much at sea in the garbage collection world, and I crave a little
more hand-holding than I'm finding so far.

Plus, I've already released one of my frameworks publicly, and it does NOT
use the __strong keyword. I'm guessing I should get a revision out there
pronto -- although I hasten to add that I know the framework works fine with
a retain/release application.

If anybody cares to take a look and tell me about any other failings in the
framework from the GC perspective, it's installed as part of my free PreFab
Event Taps Testbench product, at
<http://prefabsoftware.com/eventtapstestbench/>. I've already included
-finalize methods to complement the -dealloc methods. I don't think I need
to do anything else, but I'm far from sure.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to