[fpc-pascal] FORTRAN from FreePascal
Adriaan van Os
fpc at microbizz.nl
Sat Nov 18 17:44:02 CET 2017
Bo Berglund wrote:
> I would very much want to convert them into DLL:s programmed in Pascal
> instead so they can be maintained for new Windows versions (and use 64
> bit for example).
Well, you would have to do that by hand. And you need sufficient understanding of Fortran to know
what you are doing. I am not aware of a Fortran to Pascal converter. But why do that if Fortran
compilers are available ? And even if a Fortran compiler wouldn't exist, there is a Fortran to C
converter, named f2c. See for example <http://www.netlib.org/clapack/readme.maintain> where it reads
This README file describes how we transform LAPACK from FORTRAN into ANSI C,
and how to maintain it.
In addition to the routines translated from SRC, one needs to have
f2c.h available to compile C source; this is in F2CLIBS. The library
F2CLIBS/libF77.a needs to be linked with all routines as well. The library
F2CLIB/libI77.a needs to be linked when running the TESTING or TIMING
code, but not when using SRC code alone.
The basic translation is done by the Fortran-to-C translator f2c, which
was written by David Gay at Bell Labs, with subsequent cleanup to improve
readability. The software in the SRC directory, which contains the LAPACK
library proper (i.e. no testing code, timing code, or BLAS), is cleaned up
most completely, and so is easiest to read. We exploit the facts that these
routines do almost no I/O (the few lines of I/O in xLAMCH and XERBLA have
the ungainly f2c output replaced by hand; see below), and that they have a
standard format for leading comments. The routines in TESTING, TIMING and
BLAS are translated, but not cleaned up completely, and so they work but are
not as easy to read.
Adriaan van Os
More information about the fpc-pascal