Inline::F2003

Hi all,

I started the Inline::F2003 project in 2017 because I have a strong interest in modern Fortran and Perl programming.

The project features the Perl module Inline::F2003. This module allows modern Fortran source to be inlined and called from a Perl program. The module compiles the Fortran source and builds an executable shared library that is loaded into the Perl system.

Inline::F2003 is usually invoked at compile-time. The source fragment below shows typical use of the module.

use constant { BOOL_T => 1, BOOL_F => 0 };
use File::Spec;

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

I've uploaded a new version (1.03) to Sourceforge. The project home page is located at,

https://sourceforge.net/projects/inline-f2003/

If you are interested in Perl-Fortran interoperability I would encourage you to have a look and let me know what you think. At present the project only runs on Linux systems. All the documentation is contained in the file README.html. Please read it carefully to get a good understanding of the project.

Any comments/suggestions/questions are most appreciated.

Thank you!

(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/

Inline::F2003 - An ILSM for modern FORTRAN

I would like to announce the first release of Inline::F2003. The project features the program "matopmul.pl", which performs a matrix multiplication calculation, to showcase the use of Inline::F2003.

The project's URL is: https://sourceforge.net/projects/inline-f2003/

Inline::F2003 is a Perl extension module that allows program units written in modern FORTRAN to be added into the "__DATA__" section of a Perl program. The term "program units" is a collective FORTRAN term that refers to subroutines, functions, and modul…

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.