Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Calling Fortran From Java (without a middle man)

Reply
Thread Tools

Calling Fortran From Java (without a middle man)

 
 
hswerdfe
Guest
Posts: n/a
 
      05-02-2007
I am trying to call some fortran routines from Java as of now the native
platform I am using is Win32.

All the tutorials I find Either focus on Calling C/C++ from Java or
Fortran from C/C++ or Fortran -> C -> Java

examples:
http://www.aei.mpg.de/~jthorn/c2f.html
http://www.caip.rutgers.edu/~vincentm/JNI/jni2f.html
http://www.math.ucla.edu/~anderson/J...Interface.html
http://www.inonit.com/cygwin/jni/helloWorld/load.html

Is there a way to cut out the middle man?
and just call The fortran directly?


Thanks in Advance.

howie
 
Reply With Quote
 
 
 
 
a24900@googlemail.com
Guest
Posts: n/a
 
      05-02-2007
On May 2, 6:50 pm, hswerdfe <(E-Mail Removed)> wrote:
> Is there a way to cut out the middle man?
> and just call The fortran directly?


That would require to have a fortran compiler with a compatible
calling convention and certain extensions allowing to make us of the
dynamic memory management used by the JNI C API. Your chances to find
something like this are slim. Your best bet would be g77 in
combination with gcj, and changing to the GNU's non-standard CNI
calling interface.

Alternatively, try another middleman. E.g. JNative, JNA, Nlink, jawin,
j-interop, JNIEasy, J/Direct, NoodleGlue, JNIWrapper, SWIG or whatever
is currently on the market (talk about re-inventing the wheel ...).
Some of these tools might be dead these days.

These are tools made to avoid having to write C/C++ JNI wrapper code
when calling existing functions. Either by generating the code for
you, or by providing a dynamic invocation interface. You could try to
build your fortran code into a DLL and then try to invoke fortran
functions in the DLL by using one of these tools.

Be warned, however. JNI is not very fast, an dynamically invoking
function via some tool and JNI is even slower.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing an array from FORTRAN to C then passing it within C andReturning it to FORTRAN deadpickle C Programming 1 11-07-2010 02:38 PM
Many Fortran code! How to call Fortran code from C/C++? Luna Moon C++ 9 09-04-2007 03:49 PM
[Intel Compiler 8.1] C++ calling Fortran Routine Sascha T. C++ 3 02-16-2005 02:47 PM
Calling subroutine in fortran module Amit C Programming 5 02-07-2005 06:55 AM
Calling fortran subroutine from c Bigdakine C Programming 13 09-25-2004 08:12 AM



Advertisments