• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I call a C method from inside java code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I call a C method from inside java code?


  • Subject: Re: Can I call a C method from inside java code?
  • From: p3consulting <email@hidden>
  • Date: Tue, 20 Apr 2004 09:27:21 +0200

What you are referencing in the 2nd paragraph of your post is the "Java bridge" allowing of mixing of Java and Objective-C classes: Objective-C can use instances of classes created in Java.
But just to call a pure C function from Java (neither Java will call Obj-C objects and Obj-C will call Java objects), what you are looking for is just the "Java Native Interface": how to call external code from Java.
(native = not binary portable, you have to compile a version for each platform you want to support)

You will find an example at
http://developer.apple.com/samplecode/JNISample/JNISample.html

Pascal Pochet
email@hidden


Le avr. 20, 2004, ` 06:18, Adam a icrit :

Newbie:

I have a .c file and .h file written in the original c language. They implement a very complex method I would not like to rewrite in Java. Can I somehow pass a value into this custom c method from my java code and get the result returned in my java code?

I have herd that you can mix Java and Obj-c code in the same projects. Does this refer to the java versions of the obj-c objects or actually mixing of code from the two languages in the same project? After searching cocoa.mamasam.com and the web I found server discussions about calling java methods/objects from inside obj-c code. I would like to do the reverse, call an original and custom c method from my Cocoa Java code.



Thanks,
Adam
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Can I call a C method from inside java code? (From: Adam <email@hidden>)

  • Prev by Date: Question Applescript - Cocoa Double click on divider of NSsplitview
  • Next by Date: Re: internal frameworks in app bundle
  • Previous by thread: Can I call a C method from inside java code?
  • Next by thread: Re: cocoa-dev digest, Vol 2 #4042 - 4 msgs
  • Index(es):
    • Date
    • Thread