On Fri, Mar 28, 2008 at 9:14 AM, Trygve Inda <[EMAIL PROTECTED]> wrote:

> I have a Cocoa object with .m and .h files and need to include in this a
>  series of about 30 C functions which all all in their own .c file. Is it
>  possible to give functions in the .c file access to the .m files instance
>  variables?

No, but you can rename the file.c as file.m, pass a pointer to self
from your Obj-C method to your C function, and use the ivars' Obj-C
getters/setters within your C function.

>  How can I do this without rewriting the .c functions as Obj-C?

You don't need to rewrite anything, as you can mix C and Obj-C freely
in a .m file.

>  Also, is there a way to use two .m files for one object so that all my code
>  doesn't have to be in one file? Can I just #import one .m file into the
>  other?

You can use categories:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_1.html

Hamish
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to