December 2017 Archives

(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   => "",
             MAKEDIR    => File::Spec->curdir(),
             SRCLIST    => [ qw( ModMatrixOps.f03 ) ],
             PRINT_INFO => BOOL_T );

# Load and execute Inline::C just before end of compile-time
   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 );

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

About Ron Grunwald

user-pic I truly enjoy computer programming. The main programming languages that I use are modern Fortran, Perl, and C. My first exposure to Perl was back in 1998, while working for a geophysics company. Today, 20 years later, Perl still features heavily in my programming work. I am particularly interested in GUI and mixed language programming.