f90 mod files and library construction 
Author Message
 f90 mod files and library construction

I am accustomed in f77 to installing packages of code simply by 1)
building the package as a library and then 2) adding the name of the new
library to the LDLIBS macro in the makefile for any project that
requires it.  I gather that this won't work with f90; in addition to the
object library, the .mod files must be available to any calling code
that USEs a module. Is there some easy way to handle this?


Wed, 18 Jun 1902 08:00:00 GMT  
 f90 mod files and library construction

After thinking of the analogy with header files in C, I find in
documentation for two different f95 compilers mention of switches to
identify a directory for .mod files.  Thus I assume that whenever you
install a link library, you must sweep all the .mod files created at compile
time into the /mod/ directory.  Neither set of compiler documentation says
anything about that in its discussion of link libraries, or anywhere else
that I have found.

Modern compiler documentation, unlike past documentation for leading fortran
compilers (I don't count Microsoft), simply ignores the basic stuff needed
by the scientist who is not primarily a programmer, or hides it in a mass of
detail intended for computer professionals.  I'll have to rely on this group
for help.  Have I got it figured right?




Wed, 18 Jun 1902 08:00:00 GMT  
 f90 mod files and library construction

Quote:

>After thinking of the analogy with header files in C, I find in
>documentation for two different f95 compilers mention of switches to
>identify a directory for .mod files.  Thus I assume that whenever you
>install a link library, you must sweep all the .mod files created at compile
>time into the /mod/ directory.  Neither set of compiler documentation says
>anything about that in its discussion of link libraries, or anywhere else
>that I have found.

>Modern compiler documentation, unlike past documentation for leading fortran
>compilers (I don't count Microsoft), simply ignores the basic stuff needed
>by the scientist who is not primarily a programmer, or hides it in a mass of
>detail intended for computer professionals.  I'll have to rely on this group
>for help.  Have I got it figured right?



The mod files (OR THEIR EQUIVALENT) need to be accessible at compile
time, object files at link time.

I'm sure most compilers have a switch, or there is some environment
variable or whatever to set, to tell the compiler where to look (this
also applies to include files etc).

I generally have a directory for each project.  Mod files which are not
used anywhere else stay there, as this is searched automatically.  Mod
files which will be used by code in other directories get copied to a
repository directory.  This directory also contains object libraries,
and these are linked against.  (Actually, I have a command file which
does the linking, and then add by hand the names of the object
libraries; this is just to avoid same-name files in multiple libraries,
though it would still be overkill to link against all libraries---of
course, if you don't have that much stuff, you can just put it all in
one library).

This is for VMS, and just a quick hack, but perhaps you get the idea.

$! procedure to automatically archive .OBJ from modules and put the
$! .F90$MOD files where they can be found
$! written by Phillip Helbig, Thursday,  1-MAY-1997
$!
$  ON ERROR THEN GOTO CLEANUP
$  ON CONTROL_Y THEN GOTO CLEANUP
$  ON CONTROL_C THEN GOTO CLEANUP
$  IF P3 .EQS. "/DEBUG"
$  THEN
$    FORND 'P1'
$  ELSE
$  FORTRAN95 'P1'
$  ENDIF
$  IF P2 .EQS. "LOKAL"
$  THEN
$    TRY_AGAIN:
$      ON ERROR THEN GOTO NO_LIBRARY
$      LIBRARY/REPLACE/LOG/OBJECT LOKAL.OLB  'P1'
$    GOTO WEITER
$    NO_LIBRARY:
$      LIBRARY/CREATE LOKAL.OLB
$      WSO " [1m%FORMO-I-LIBCRE, library LOKAL.OLB did not exist; ",-
           "I just created it [0m"
$    GOTO TRY_AGAIN
$!    GOTO WEITER
$  ENDIF
$  IF P2 .NES. ""
$  THEN
$    ON ERROR THEN GOTO N0_LIBRARY
$    LIBRARY/REPLACE/LOG/OBJECT F95_LIB:'P2'.OLB  'P1'
$    ON ERROR THEN GOTO CLEANUP
$    COPY/LOG 'P1'.F90$MOD F95_LIB
$    PURGE/NOCONFIRM/NOLOG/KEEP=3 F95_LIB:'P1'.F90$MOD
$  GOTO WEITER
$    N0_LIBRARY:
$      WSO " [1m%FORMO-W-NOLIB, library ''P2'.OLB does not exist; ",-
           "create it explicitly and try again [0m"
$    GOTO WEITER
$  ELSE
$      WSO " [1m%FORMO-I-TEST, This was just a test.  ",-
           "Type ""FORMO ''P1' <LIBRARY_NAME>"" to add to the library. [0m"
$  ENDIF
$GOTO WEITER
$  CLEANUP:
$    WSO " [1m%FORMO-I-ABORT, aborted before normal completion [0m"
$  EXIT
$  WEITER:
$    WSO "%FORMO-I-NORMAL, normal completion"
$  EXIT



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. f90 on cray - .mod files?

2. What's .mod file in f90?

3. 'library' of .mod files

4. mod sound file editing library?

5. Fortran90 static library and .mod files

6. compile problems: .mod files and libraries

7. .mod in F90

8. MOD Library ?

9. Link mod unable to find library...

10. MOD and /MOD with Pygmy Forth

11. SM/REM FM/MOD and UM/MOD on a 32bit cell ix86 Forth

12. Utils.Mod, ET.Mod

 

 
Powered by phpBB® Forum Software