Skip to content
Prev 35444 / 63421 Next

Calling Fortran90 code from R

2009/12/29 Simone Giannerini <sgiannerini at gmail.com>:
....(helpful example removed)...
Dear Simone (and others reading),

first of all thanks for your helpful example. While I did something
similar yesterday, it did give me a simple example to start from which
worked, and find a nice approach to solving my problems. A brief
summary of the origin of my problems, which are related to the use of
Fortran90 module declarations.

It is perfectly possible to call Fortran90 code compiled with
gfortran. Compiling a subroutine/function "foo" will produce a symbol
"foo_" in the dynamic library. If, however, the subroutine is
contained in a module named "modname", the symbol will be called
"__modname_MOD_foo". In  this case, it will not be found by the
".Fortran" call or a call to "is.loaded", at least I have not found
any way to do this. However, for my purposes, I have simply added a
set of wrapper subroutines to the library (which I planned to add
anyway for other reasons, in particular to reduce the number of
arguments), which forwards the calls to the module functions, and
everything seems to work all right.

Kind Regards,
Hartwig