(Update) Inline::F2003 - An ILSM for modern FORTRAN

An updated version, 1.01, of “matopmul” has been released on SourceForge. This version contains several fixes for the Inline::F2003 module. In particular, when a new FORTRAN compiler is specified through the FOR => “compiler” configuration option, Inline::F2003 recognises the change and recompiles the FORTRAN source with the new compiler.

Another change is that both Inline::F2003 and Inline::C can now load and execute at Perl’s compile-time. This further implies that the FORTRAN and C sources may both appear under the “__DATA__” section of the program.

use Inline F2003 => "DATA",
           ( FOR        => "gfortran",
             MAKEFILE   => "matopmul.mk",
             MAKEDIR    => File::Spec->curdir(),
             SRCLIST    => [ qw( ModMatrixOps.f03 ) ],
             PRINT_INFO => BOOL_T );

# Load and execute Inline::C just before end of compile-time
INIT {
   my @C_Config = ( MYEXTLIB    => $main::F2003Lib{PATHFN},
                    FORCE_BUILD => $main::F2003Lib{ISNEW},
                    CCFLAGSEX   => "-std=c99",
                    PRINT_INFO  => BOOL_T );

   Inline->import( C => "DATA", @C_Config );
   Inline->init();
}

In this source fragment, Inline::F2003 and Inline::C both receive the relevant source code from the “__DATA__” section of the program. Notice that Inline::C loads and executes inside an INIT block. This is necessary to ensure that the package variable %F2003Lib is exported before Inline::C is loaded. The detailed description is found in the “README.txt” file under the section “USING THE MODULE”.

The updated release is available at https://sourceforge.net/projects/inline-f2003/

Leave a comment

About Ron Grunwald

user-pic I consider myself a casual programmer these days, as I'm pursuing a career in writing. My main interests are modern Fortran, Perl and C.