XS gives Perl access to C wrappers. Most C
environments on systems that have FORTRAN will support calling
FORTRAN routines from C. So Perl calls XS wrappers
written in C which calls the FORTRAN code. Note that this
is no less efficient than the "normal" case of Perl
calling XS wrappers written in C which call the C code
of some library.
I would not suggest trying to remove
C from the equation and write XS wrappers in FORTRAN.
There may be cases where it is worthwhile to have the
XS wrappers written in C call FORTRAN wrappers that then
call the FORTRAN routines in some library. This would be
useful if the library routines require data in a very
FORTRANish format that is even a little difficult (or even
impossible) to set
up via C. You might also want Perl wrappers that call
the XS C code. Then you can have a very Perl-like interface
that is easy to use and maintain.
The Perl wrapper
accepts data in the mind-numbingly flexible ways that only
a Perl routine can, standardizes it into quite simple Perl
data types that make it nearly trivial to write the XS C
code. The C code does minor conversions (if any) required to
get that data in a format the both C and FORTRAN can handle
easily, but more importantly knows how to pass data to a
FORTRAN routine. The FORTRAN wrapper takes the simple data
and converts it to the format expected by the library
routine that was written with no expectation that it should
ever making interfacing to C, much less Perl, easy.
Sorry, I don't know any specifics about SWIG with FORTRAN.
|