This project uses SWIG-Fortran to expose useful functionality from the C++ standard library to Fortran 2003 application developers. It generates self-contained Fortran modules with native proxy classes and functions which wrap the C++ standard library.
Currently it's designed around the C++11 standard library, and it instantiates 32- and 64-bit integers as well as double-precision floats. All operations directly manipulate arrays of Fortran-owned data to minimize overhead.
Functionality includes:
- Sorting, both canonical and with custom comparison function
- Binary search for indices in a sorted array
- Pseudo-random number generation, including a Gaussian/normal distribution
Installation of Flibcpp is trivial, as it requires no external dependencies other than existing and compatible C++ and Fortran compilers, and a relatively recent version of CMake:
- Clone the repository with
git clone https://github.com/swig-fortran/flibcpp
or download a release - Create a build directory and execute
cmake $PATH_TO_SOURCE
(requires CMake 3.8 or higher) - Install using
make install
More detailed installation instructions are available in the documentation. An example Fortran application that depends only on Flibcpp is available on Github.
The latest documentation is hosted on readthedocs.io.
Pull requests are welcome. Feature requests can be added as issues. If there is strong interest in adding an option for C++03 compatibility, it could be added. It would also be trivial to add support for single-precision floats, but since most scientific software uses double-precision, we only support those for now.
The source code for FlibCpp, including auto-generated code, is released under an MIT license. See the LICENSE file.
It must be linked against an existing C++ standard library implementation (e.g. libc++ or libstdc++), so those are not covered by this license.
SWIG is not required to use this project. SWIG-generated code does not inherit SWIG's GPL license.
The CgvFindVersion.cmake helper script used for determining the release info is released independently under an Apache-2.0 license.