Re: Calling a Cocoa library from C
Re: Calling a Cocoa library from C
- Subject: Re: Calling a Cocoa library from C
- From: Nathan Sims <email@hidden>
- Date: Sat, 12 Nov 2011 10:45:58 -0800
On Nov 11, 2011, at 6:22 PM, Wim Lewis wrote:
> int get_float_data(float *result1, float *result2)
> {
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> @try {
> [objcCode call];
> *result1 = [more stuff];
> etc.;
> } @catch {
> fprintf(stderr, "omg doomed!\n");
> etc.;
> } @finally {
> [pool drain];
> }
>
> return blahblah;
> }
Wow, I didn't realize how integrated C and Objc are, that you could employ Objc code from a C function. Kewl.
Okay, does this mean that an object instantiated by a C function has persistence across C function calls? In the example above you have:
[objcCode call];
I'm guessing I would have to have:
ObjcCode *objcCode;
declared globally in the library, and that would suffice?
Thanks!
_______________________________________________
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