I don't think so, not it if has a C-language prototype rather than an Objective-C method prototype.
However, I expect there is a way you could call an Objective-C method from vanilla C. Possibly you will need some assembly-language glue. Ultimately, Objective-C method calls are implemented, I expect, as C functions that have some "extra stuff" attached, for example to pass in "self" as a hidden (first I think) parameter. Try writing a small Objective-C method, that calls another one in the same source file. Then in Xcode, use Product -> Generate Output -> Assembly File to see how that first method calls the second. You will need some way for your C callback to be told what "self" is. Mike Crawford li...@warplife.com http://www.warplife.com/ On Tue, Jul 30, 2013 at 7:59 AM, Vincent Habchi <vi...@macports.org> wrote: > Hi everybody, > > I have a very simple question: if I embed a C-function (more precisely, a > callback from an external C-library) in an Obj-C object, can I expect this > function to behave like a regular method? I.e. can it freely access ‘self’ > and other attributes? > > Thanks a lot! > Vincent > > > > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/lists%40warplife.com > > This email sent to li...@warplife.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com