• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Building a dynamic class factory ( +load init order)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building a dynamic class factory ( +load init order)


  • Subject: Re: Building a dynamic class factory ( +load init order)
  • From: Thomas Engelmeier <email@hidden>
  • Date: Sat, 29 Dec 2007 11:23:21 +0100


On 29.12.2007, at 00:27, Ken Ferry wrote:

Hi Ken,

Whatever the problem is, I don't think it's in the info you posted
(which doesn't look like real code).

For debugging purposes the real code was a comment-out mess.
*sigh* I pinned it down to an typo in the real code, actually an "C- string" literal instead of an @"NSString". I really shouldn't code influenced by some influenca...


Debugging was partially tricky, Xcode / gdb most of the time failed with a sigsegv, alternating with
"Xcode: Introspection dylib not loaded because thread 1 has function: __dyld__ZN4dyld12notifySingleE17dyld_image_statesPK11mach_headerPKcl on stack", i.e. dyld::notifySingle(dyld_image_states, mach_header const*, char const*, long).



The docs on +load are too paranoid, and are due to be revised. As of
Leopard, you can count on all +load methods in frameworks you link to
be called before any +load method in your code.

OK, great for the clarification. Otherwise I had rewritten the code anyway.


Though, the autoreleased dictionary would
leak and spew a log to the console due to there being no autorelease
pool in place at this point.

Thanks for that hint.

The message to TELibraryFactory is safe in that the class object will
exist at this point, but if the class has a +load method, it may not
have run yet.  TELibraryFactory's +load will run before that of any of
its subclasses, though.

My first variant used a C function to prevent any race conditions. So the Leopard +load order is also baseclass to subclasses, like +initialize?


Thanks,
	Tom_E
_______________________________________________

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


References: 
 >Building a dynamic class factory ( +load init order) (From: Thomas Engelmeier <email@hidden>)
 >Re: Building a dynamic class factory ( +load init order) (From: "Ken Ferry" <email@hidden>)

  • Prev by Date: Re: writeToFile alternative?
  • Next by Date: Re: Best way to do simple binary file I/O?
  • Previous by thread: Re: Building a dynamic class factory ( +load init order)
  • Next by thread: QTTrack is awfully limiting
  • Index(es):
    • Date
    • Thread