Consider the following set of Fortran module files:

(These files are actually part of the ParaMonte library). These modules depend on each other:

  • Math_mod uses Constants_mod and String_mod,
  • String_mod uses Constants_mod and JaggedArray_mod,
  • JaggedArray_mod uses Constants_mod,

Problem Part 1: calling the String_mod as a DLL

Fortran

Write a main Fortran program that uses the String_mod compiled as an external DLL library file named string. The program calls the replaceStr() function in String_mod to replace "FORTRAN" with "Fortran" in the following sentence,

sentence = "FORTRAN is a highly flexible expressive natively-parallel programming language for numerical computing."

such that the output of the main program is the following,

mainCallString.exe
Fortran, not FORTRAN, is a highly flexible expressive natively-parallel programming language for numerical computing.

Problem Part 2: calling the Matho_mod DLL which depends on String_mod DLL

Fortran

Now, write a main Fortran program which calls the getDistanceSq() function of Math_mod from the math DLL (that you will have to build). Note that this Math_mod will depend on the string DLL file from the previous problem in the above.

Comments