Couple a FORTRAN library with Strurel (MinGW-compiler)

The latest version of Sturel allows you to couple external libraries with the application. In this post we show how to link a limit-state function written in FORTRAN to Comrel. As compiler we employ a variant of the free MinGW compiler (https://mingw-w64.org/).

Install the 64-bit MinGW compiler

First, you have to download the installer mingw-w64-install.exe from https://sourceforge.net/projects/mingw-w64/. Thereafter, please execute the downloaded installer and select x86-64 as architecture (you do not have to modify the other settings).

Compile the FORTRAN limit-state function

We assume that you implemented your limit-state function of interest in FORTRAN. A FORTRAN limit-state function that you can use as template can be downloaded from: http://strurel.com/files_blog/DLL_GNU_FORTRAN/Module.for

In this tutorial, we will directly compile the above mentioned file. The function is compiled using the Windows command prompt (cmd.exe). In the command prompt, first go to the installation directory of mingw-w64 (you can change directories with the command cd) and execute the bat-file mingw-w64.bat. Thereafter, to the folder containing the FORTRAN limit-state function and execute the following commands:

gfortran -fno-underscoring -c Module.for
gfortran -O3 -shared -o FORDLL.dll Module.o

where Module.for is the name of the FORTRAN file to compile and FORDLL.dll is the name of the DLL-library to generate.

If you do not have the FORTRAN compiler installed, you can download the compiled library from:
http://strurel.com/files_blog/DLL_GNU_FORTRAN/FORDLL.dll

Load the compiled library in Comrel

If you compiled the above mentioned template file without modifications, you can download the file Comrel file Pressure-Vessel.iti from:
http://strurel.com/files_blog/DLL_GNU_FORTRAN/Pressure-Vessel.iti
Put the file in the same folder as the compiled library (e.g., FORDLL.dll), and open the file with Comrel to see how the library can be used to perform a reliability analysis.