Calling Fortran From Java (without a middle man)

H

hswerdfe

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/JAVAclass/JavaInterface/JavaInterface.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
 
A

a24900

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top