Hey all! I'm fairly new to objective-c so I have never had to tackle this issue yet. I have a C function in my objective-c class and I want to be able to call a method on a property of the containing objective-c class.
I understand that my C function will not understand what 'self' is if I try to just send a message [self.delegate doSomething]
I assume what I need to do is give my c function a pointer to my class so I can do something like this:
myClass->delegate ->doSomething();
I would like to store a pointer to the current object (self) in a global variable because I am not able to change the function signatures. I want to be able to access the pointer from any C function defined within this class. The reason for this is that I am writing a wrapper around a C library I am trying to use. If it can be helped.. I'd rather not modify the source to this library.
Can someone please help me out with how to get a pointer to the current object? Thanks!
void event_privmsg (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
{
//[self.delegate privateMessage]; I would like to do the following
}