Fortran

Guide To Learn

Before we write any Fortran code, we’ll first download and compile the C library that we’ll work with: libdill. You can download the code from http://libdill.org/download .html. This page also includes brief installation instructions. For our work, we won’t need to install libdill systemwide. Instead, we’ll compile it and take a copy of the compiled library archive file:

curl -O http://libdill.org/libdill-2.14.tar.gz     ❶
tar xzf libdill-2.14.tar.gz                        ❷
cd libdill-2.14                                    ❸
./configure                                        ❹
make                                               ❺
cp .libs/libdill.a ..                              ❻

❶ Downloads the libdill tarball using curl

❷ Unpacks the libdill source code

❸ Moves into the libdill source directory

❹ Configures for building

❺ Compiles the code

❻ Makes a copy of the compiled library archive file, libdill.a

Here I used curl instead of wget (suggested at the libdill website) because it’s more likely to already be installed on most Linux operating systems. If you prefer wget and have it on your system, by all means feel free to use that instead.

At the time of this writing, 2.14 is the current libdill version, and we’ll use that version in this book. However, it’s quite possible that you’re reading this book years after its publication. If that’s the case, you may want to use a later libdill version that may have bug fixes and performance improvements, if available. All the code and Fortran interfaces should still work with a later 2.xx version of libdill, assuming its API doesn’t change.

Issues compiling libdill?

Specific versions of some compilers may have difficulty compiling one or more of libdill’s components. If you encounter any issues, take a look at https://github.com/ modern-fortran/tcp-client-server for potential solutions.

Installing libdill

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top