Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

mixing java & C on Linux

Thread view: 
Drazen Gemic - 29 Sep 2005 02:45 GMT
I am able to call some C code from Java via JNI.

Is it possible to compile Java with gcj and call the same
C code directly ? What needs to be done ?

DG
puzzlecracker - 29 Sep 2005 03:13 GMT
> I am able to call some C code from Java via JNI.
>
> Is it possible to compile Java with gcj and call the same
> C code directly ? What needs to be done ?
>
> DG

sure...
Roedy Green - 29 Sep 2005 05:00 GMT
>Is it possible to compile Java with gcj and call the same
>C code directly ? What needs to be done ?

I don't think so. The JNI interface would remain the same.  It is not
as though native compilation works by turning Java into C first.
You could do a quick experiment to see if GCJ in expecting a JNI
interface for native methods.  There are several native classes
available to download on my website.

I suggest
http://mindprod.com/products1.html#PENTIUM
http://mindprod.com/products1.html#FILETIMES
http://mindprod.com/products1.html#MOUSE

http://mindprod.com/products1.html#SETCLOCK is probably a bit too
complicated.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 29 Sep 2005 06:57 GMT
>http://mindprod.com/products1.html#PENTIUM

this one would be easiest to port to Linux. It  does no system calls.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

David N. Welton - 29 Sep 2005 08:27 GMT
> I am able to call some C code from Java via JNI.
>
> Is it possible to compile Java with gcj and call the same
> C code directly ? What needs to be done ?

If you are only interested in targeting gcj, you might also look at CNI:

http://gcc.gnu.org/onlinedocs/gcj/About-CNI.html

Ciao,
Signature

David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.