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

Sharing Module Data

kulachi
Beginner
450 Views
Hi,

How do I share a Module among different Fortran projects in a Mutliproject Solution? Here is some detail of the context:

I am building a Mixed Langauge MultiProject Solution where C/C++ is the main executable. There are two seperate static Fortran LIBs (as seperate projects LIB1 and LIB2). LIB1 is rather extensive and does the main work. The Module (containing the shared data) is placed in LIB1. Now when I add LIB2 to the Solution (as a seperate Fortran Project (static Lib)) and try to access the module using USE Module from LIB1, the compiler says:

C:\...\Lib2.F90(2) : Error: Error in opening the compiled module file. Check INCLUDE paths. [SHAREDDATA]

(where SHAREDATA is the name of the Module).

I tried to change dependencies but the same problem persists.

Is there a way around this?

-Kulachi
0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
450 Views

Modules are a bit strange at first. Unlike for C/C++, the compiler produces two output files: the yourfile.mod file and the yourfile.obj file. The INCLUDE path should include the path to the .mod filescreated for the .obj files containedwithin the library (or those .obj files linked directly)and the LIB path should include the path to the specified library.

Think of the .mod files as equivilent toC++ pre-compiled headers. And the fortran compiler is instructed to USE specified pre-compiled headers but is unable to locate those files (files ending with .mod). The Linker/Librarian is to be instructed to include the .obj files (if any) produced when producing the .mod files. .mod files need not have an acompaning .obj file (e.g. when it only declares types and/or interfaces).

Jim Dempsey
0 Kudos
Reply