Re: Trouble calling class_addIvar()

2010-10-08 Thread Bill Bumgarner
On Oct 8, 2010, at 5:27 PM, Rick Mann wrote: > Hmm...thinking about it a bit more...how do dynamically-synthesized property > ivars work (where you just @synthesize them without declaring an ivar)? Do > they use class_addIvar()? That suggests I'm wrong about class layout. It be compilation tim

Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
On Oct 8, 2010, at 17:12:28, Kyle Sluder wrote: > The documentation states you can't add ivars to classes that have > already been registered. In order for a class to receive +initialize, > it logically must already have been registered with the runtime. > Therefore, it's quite apparent why class

Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
Oh. I can't even really use this. I don't know what I need to associate at runtime, at which point I know what it is by a string value. Since I can't use a string value as a key, I can't really make the association. I could associate an NSMutableDictionary, but if I do that, I may as well just m

Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
On Oct 8, 2010, at 17:12:28, Kyle Sluder wrote: > On Fri, Oct 8, 2010 at 5:00 PM, Rick Mann wrote: >> Yes, I read that. I had hoped that I'd be able to add ivars before the class >> was instantiated. In this case, the class is being loaded dynamically at run >> time. Is there no way to get in

Re: Trouble calling class_addIvar()

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 5:00 PM, Rick Mann wrote: > Yes, I read that. I had hoped that I'd be able to add ivars before the class > was instantiated. In this case, the class is being loaded dynamically at run > time. Is there no way to get in the middle of the load and add an ivar? > > In any case

Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
On Oct 8, 2010, at 16:42:18, Kyle Sluder wrote: > On Fri, Oct 8, 2010 at 4:39 PM, Rick Mann wrote: >> I'm trying to add an ivar to a (sub)class in the base class' +initialize >> method. I'm not sure if it's too late to do it at this point or not. If I >> can't do it here, i don't know where to

Re: Trouble calling class_addIvar()

2010-10-08 Thread Dave DeLong
I think you can only use class_addIvar() in between corresponding calls to objc_allocateClassPair() and objc_registerClass(). Docs: http://developer.apple.com/library/ios/documentation/cocoa/reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/doc/uid/TP40001418-CH1g-SW10 Dave On Oct

Re: Trouble calling class_addIvar()

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 4:39 PM, Rick Mann wrote: > I'm trying to add an ivar to a (sub)class in the base class' +initialize > method. I'm not sure if it's too late to do it at this point or not. If I > can't do it here, i don't know where to make the call. >From the documentation: "Adding an i

Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
I'm trying to add an ivar to a (sub)class in the base class' +initialize method. I'm not sure if it's too late to do it at this point or not. If I can't do it here, i don't know where to make the call. I'm calling it like this: char const* ivarNameCString = ivarName.UTF8String;