Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode JNI project



Thanks for the suggestions guys - all have helped with my understanding of the situation. Here's what I have now:

1) A C file with an auto generated header file (auto-generated from the corresponding Java class's methods marked "native - not exactly sure how this happens)
2) An Objective-C M file, which will have my Cocoa calls
3) I've added the Cocoa.Framework under Targets->JNILib->Link Binary With Library by right clicking it and adding the framework under "Linked Libraries".

Everything builds fine until I include the Objective-C's header file my C file. When i include the header, I get all sorts of errors (see attached screen shot).

Any thoughts?


On Sep 27, 2008, at 11:00 AM, Alexei Svitkine wrote:

Have two files. A .m file that does what you want, and exposes that as a C function. And the C file that just calls that function.

-Alexei

On Sat, Sep 27, 2008 at 10:05 AM, Michael Hall <email@hidden> wrote:

On Sep 27, 2008, at 8:41 AM, Ken Orr wrote:

C file via "import <Cocoa/Cocoa.h>


First you wouldn't include that in a C '.c' file, it would have to be an Objective-C '.m' file. A '.c' file will imply a straight 'C' compile and the compiler won't know how to handle the Objective-C specific syntax it runs into in the Cocoa.h file. This should get real errors, not warnings, and should not in any way succeed - so maybe this isn't what you mean?

Mike Hall        hallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

<ATT00001.txt>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >XCode JNI project (From: Ken Orr <email@hidden>)
 >Re: XCode JNI project (From: Michael Hall <email@hidden>)
 >Re: XCode JNI project (From: "Alexei Svitkine" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.