From: Steven S. <ste...@gm...> - 2006-05-05 05:44:45
|
If you can live without the fortran, you could use f2c (http://www.netlib.org/f2c/) to translate your Fortran to C and then SWIG that. That is of course, if you can live without the Fortran. Steven On 5/4/06, Mosher, Chuck C. <Chu...@co...> wrote: > > > > > I've been perusing the lists and docs to see what folks are doing to > interface Fotran libraries to Java. > The standard approach seems to be: > Create "C" wrappers for the Fortran code > Use SWIG to link the C(Fortran) code to Java > > We've got a ton of Fortran libraries to go through, and it would be reall= y > nice to avoid the "C" wrapper step. Most of the Fortran programs have bee= n > structured to make calling from "C" easy - no strings, structures, etc. > Just primitive types and arrays. But many of the routines do pass multipl= e > values back through the argument list. In my "dream" situation, all I nee= d > to create is a "my_library.i" file with lines like: > > %module my_library > %{ > void sub1_( int*, float*, float*, float[] ); > void sub2_( int*, int[], float* ); > =85 > %} > void sub1_( int*, float*, float*, float[] ); > void sub2_( int*, int[], float* ); > =85 > > Run swig, and I've got "my_library.java" with static references to all my > old Fortran routines. The Java method signatures would look something lik= e: > > Void sub1( int, float, float, float[] ); > Void sub2( int, int[], float ); > > Note that change of pointers to values, but retention of array references= . > > I've tried to do some of this with typemaps without much success. > > Is this "dream" unattainable without creating a new language support modu= le > ? > > Thanks, > Chuck Mosher > JavaSeis.org > chu...@us... |