Re: Call back from C++ code.
Re: Call back from C++ code.
- Subject: Re: Call back from C++ code.
- From: "innovator information" <email@hidden>
- Date: Wed, 29 Mar 2006 19:40:45 +0530
I am using obj-C++ only. Sorry for mistake for mentioning it as Obj-C.
I have C++ classes. I was not able to call Obj-C++ Object function from there.
Please provide me link. I can read and do it.
Regards,
Raj
On 3/29/06, Nicko van Someren <email@hidden> wrote:
> On 29 Mar 2006, at 14:34, innovator information wrote:
> > I am using Obj-C for Cocoa development.
> > And my library is C++. I am using C++ very comfortably with Obj-C.
> > I want a callback function for a Obj-C object from C++ class.
> > How can I call a Obj-C function from C++ ?
>
> There are two ways to do this. One is to read up on Objective C++,
> [1] which is a bit of a car crash between Objective C and C++. You
> can then write the code in a file with the .mm. Alternatively, if
> you don't need to do a huge amount of code and you already have C++
> and Objective-C working happily in your application you can use the
> fact that regular C functions which exist in .m files can send
> Objective C messages. Thus you can write a function like this:
> void tell_thing_to_to_foo(void *thingptr) {
> [(Thing *) thingptr foo];
> }
> Ifyou declare this as a regular C function in a header file then it
> can then be called as a plain-old-C callback from your C++ code.
>
> Nicko
>
> [1] http://developer.apple.com/documentation/Cocoa/Conceptual/
> ObjectiveC/Articles/chapter_4_section_10.html
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden