*.mod files

117 views
Skip to first unread message

Bryan Everly

unread,
Jul 30, 2016, 2:00:01 PM7/30/16
to
Hello,

When you are distributing a library in C, you supply any necessary header files and the compiled library (*.a, *.so, etc.)

In modern Fortran, when you distribute a library do you supply the *.mod files for your modules?

If so, are they binary compatible across platforms?

Thanks in advance for anyone who can clear that up for me!

Richard Maine

unread,
Jul 30, 2016, 2:16:02 PM7/30/16
to
Bryan Everly <br...@bceassociates.com> wrote:

> When you are distributing a library in C, you supply any necessary header
> files and the compiled library (*.a, *.so, etc.)
>
> In modern Fortran, when you distribute a library do you supply the *.mod
> files for your modules?

Yes.

> If so, are they binary compatible across platforms?

No.

When you compile a module, the compiler creates both .mod and .o files
(or the equivalent, but those are the usual naming conventions.) Both
are compiler-dependent and you need to distribute both (or source code).

The .mod file is used during compilation of code that USEs your module.
The .o file is used during linking.


--
Richard Maine
email: last name at domain . net
dimnain: summer-triangle

Gary Scott

unread,
Jul 30, 2016, 6:09:24 PM7/30/16
to
Most commercial packages will distribute static libraries and/or DLLs
and associated import libraries AND .mod files.

herrman...@gmail.com

unread,
Aug 1, 2016, 5:48:29 PM8/1/16
to
On Saturday, July 30, 2016 at 11:00:01 AM UTC-7, Bryan Everly wrote:

> When you are distributing a library in C, you supply any necessary header
> files and the compiled library (*.a, *.so, etc.)

In C, object programs are often enough portable to use with a different compiler
on the same system. In the beginning, gcc was used with many Unix systems,
along with the existing libraries, but hopefully with improved optimization.

Since the C I/O system works by direct calls to library functions, it is often
close enough to portable. (Assumes the same calling sequence.)

Fortran I/O calls library routines based on the Fortran I/O statements, and
are pretty much never portable between compilers from different sources,
and not always from different versions of the same compiler.

Calls to generic intrinsic routines also might call different routines.

> In modern Fortran, when you distribute a library do you
> supply the *.mod files for your modules?

> If so, are they binary compatible across platforms?

It would seem that the information that goes into a .MOD file
should be the same for all platforms, but traditionally they
are not portable.

It would be a little easier to distribute, if you could send out one
MOD file, and then separate libraries for each target system.

Also, a text based standardized MOD system would allow for calls
to/from C, with appropriate work in between.

Reply all
Reply to author
Forward
0 new messages