Re: Compiler doesn't see instance variable
Re: Compiler doesn't see instance variable
- Subject: Re: Compiler doesn't see instance variable
- From: Carter Harrison <email@hidden>
- Date: Sun, 27 Jul 2008 10:47:32 -0400
Ok great thanks for the assistance.
On Jul 27, 2008, at 10:19 AM, Clark Cox <email@hidden> wrote:
On Sun, Jul 27, 2008 at 5:51 AM, Carter R. Harrison
<email@hidden> wrote:
I'm having an interesting problem today. I'm working with the
event-driven
XML parser in Core Foundation. For those of you who aren't
familiar with
that parser, you have to implement at least 3 callback methods:
Those aren't methods, they're functions.
void *createStructure(CFXMLParserRef parser, CFXMLNodeRef node,
void *info)
void addChild(CFXMLParserRef parser, void *parent, void *child,
void *info)
void endStructure(CFXMLParserRef parser, void *xmlType, void *info)
Inside the addChild method, I attempt to access an instance
variable that is
defined within the header file for the source file in which the
callback
methods are defined. For some reason the compiler is unable to see
my
instance variables when referenced from these methods. The
compiler gives
me a "error: 'parseArray' undeclared (first use in this function)".
Any ideas as to what I'm doing wrong? Thanks in advance.
Functions don't have access to any instance methods (how could they,
they don't have an instance). Typically, what one would do is pass
'self' as the info parameter, and then either access instance
variables through info (by casting it to a pointer to your class
type), or simply call a method on that same instance, and do your work
there.
--
Clark S. Cox III
email@hidden
_______________________________________________
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