- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
I am new to FORTRAN, and I am investigating if it is possible to link to binaries generated with Visual Fortran (Composer XE 2011) when using the gfortran compiler to generate the final executable. For example, when I tried to use *.mod files compiled with VF I got the error message:
Fatal Error: File 'module_gpops.mod' opened at (1) is not a GFORTRAN module file
So I tried to create libraries with VF and link against them with the command
gfortran -ffree-form -ffree-line-length-none -fimplicit-none -fno-range-check -Wall -g \\
-L/home/dcantwell/launch -lgpopsf -lsnopts \\
C:/home/GPOPS/launch/modules/*.f90 C:/home/GPOPS/launch/src/*.f90 \\
-o launch.exe
but got the error
Fatal Error: Can't open module file 'module_gpops.mod' for reading at (1): No such file or directory
I confirmed that the modules were contained in the libraries (libgpopsf.a, libsnopts.a) I made with VF. Is it just not possible to link with binaries not made with gfortran, or am I doing something wrong that can be corrected? Thnx for any help.
I am new to FORTRAN, and I am investigating if it is possible to link to binaries generated with Visual Fortran (Composer XE 2011) when using the gfortran compiler to generate the final executable. For example, when I tried to use *.mod files compiled with VF I got the error message:
Fatal Error: File 'module_gpops.mod' opened at (1) is not a GFORTRAN module file
So I tried to create libraries with VF and link against them with the command
gfortran -ffree-form -ffree-line-length-none -fimplicit-none -fno-range-check -Wall -g \\
-L/home/dcantwell/launch -lgpopsf -lsnopts \\
C:/home/GPOPS/launch/modules/*.f90 C:/home/GPOPS/launch/src/*.f90 \\
-o launch.exe
but got the error
Fatal Error: Can't open module file 'module_gpops.mod' for reading at (1): No such file or directory
I confirmed that the modules were contained in the libraries (libgpopsf.a, libsnopts.a) I made with VF. Is it just not possible to link with binaries not made with gfortran, or am I doing something wrong that can be corrected? Thnx for any help.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears that you are confusing the *.mod files produced by compiling Fortran 9X modules with 'modules' in the old IBM 360 sense. The Fortran module files are used by the compiler and not the linker. The linker uses .o and .a and .so files, and knows nothing about .mod files. Therefore, libraries (.a and .so) do not contain Fortran module files.
It is the .mod files that are not compatible across compilers. The incompatibilities of the .o files are much less, if any. If you organize your sources such that none of the modules compiled by one compiler are USEd in sources delegated to the other compiler, and the two compilers use compatible ABIs, you may get things to work.
It is the .mod files that are not compatible across compilers. The incompatibilities of the .o files are much less, if any. If you organize your sources such that none of the modules compiled by one compiler are USEd in sources delegated to the other compiler, and the two compilers use compatible ABIs, you may get things to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In general, objects from different Fortran compilers are not compatible. You must use a single Fortran compiler to compile all your Fortran sources. But indeed .mod files are specific to the compiler that produced them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thnx mecej4, this cleared some things up for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thnx for the reply Steve; the responses have been helpful.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page