Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Information stored in the .mod files

albert
Beginner
350 Views

Dear all,

I'm a bit curious which information is exactly stored in the .mod files.

I know that a.o. variables names, parameters, type definitions and function prototypes are stored in the .md file and that initializations and function bodies are stored in the .o file.

I'm wondering if the layout, e.g. the offset of variables etc. in a module are stured as well.

I tried to find a format description of the .mod file but was not successful.

Any information is helpful.

Best Regards,

Albert

0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
350 Views

Think of a .mod file as a precompiled header.

If the source file contains just module(s) without: initialization, contains code, or tacked on procedures then compiler outputs a .mod file (or multiple mod files, one for each module).

If the source file contains with: initialization, contains code, or tacked on procedures then compiler outputs a .mod file (or multiple mod files, one for each module), plus a .obj file containing the compiled code. The .MOD files folder needs to be in the include path, the .obj file folder in the linker input path (or explicitly specified).

Jim Dempsey

0 Kudos
albert
Beginner
350 Views

Thanks for the answer, but to be honest most of the information was already mentioned in the original post.

Interesting is the layout of the .mod file, e.g. if the offset of variables etc. in a module are stored as well.

I tried to find a format description of the .mod file but was not successful.

Albert

0 Kudos
Steven_L_Intel1
Employee
350 Views

There is no object code information in .mod files. As Jim says, it contains information on declarations used during compiling. If you have a derived type, the types and order of the components are in the .mod file, but not relative locations of module variables. Routine declarations are there but no code. The format of .mod files is not documented - it's effectively the compiler's internal symbol table.

0 Kudos
Reply