Fortran 2008 interface bindings to selected POSIX and SysV procedures
A work-in-progress collection of Fortran 2008 ISO C binding interfaces to
selected POSIX and SysV types, functions, and routines on 64-bit Unix-like
operating systems:
Similar libraries for modern Fortran:
Currently, only Linux (glibc) and FreeBSD are supported. The library has been
tested on:
Preprocessor macros are used to achieve platform-independent interoperability.
Therefore, your Fortran compiler has to support at least GNU preprocessor
conditionals.
Run either GNU/BSD make or FPM to build
the static library libfortran-unix.a
. Link your Fortran application withlibfortran-unix.a
, and optionally with -lpthread
to access POSIX threads, or-lrt
to access POSIX message queues.
On FreeBSD, run:
$ make freebsd
To build with LLVM 20 instead:
$ make freebsd CC=clang20 FC=flang20
On Linux (x86-64), run:
$ make linux
On Linux (aarch64), run:
$ make linux_aarch64
To build with Intel oneAPI, run:
$ make CC=icx FC=ifx PPFLAGS=
Optionally, install libfortran-unix.a
and the associated module files
system-wide:
$ make install PREFIX=/opt
--- Installing libfortran-unix.a to /opt/lib/ ...
--- Installing module files to /opt/include/libfortran-unix/ ...
Using FPM, a preprocessor flag has to be passed to GNU Fortran. On FreeBSD:
$ fpm build --profile release --flag "-D__FreeBSD__"
On Linux (x86-64):
$ fpm build --profile release --flag "-D__linux__"
On Linux (aarch64):
$ fpm build --profile release --flag "-D__linux__ -D__aarch64__"
The source code documentation of the library has to be created with
FORD. Install the Python
package with:
$ python3 -m pip install -U ford
In the source repository, either run:
$ make freebsd_doc
Or:
$ make linux_doc
The HTML files will be written to directory doc/
. Open index.html
in a web
browser.
Examples are provided in directory examples/
:
CTRL
+ C
).uname()
.To compile the example programs, either run:
$ make freebsd_examples
Or:
$ make linux_examples
ISC