Linking a Fortran program with Cernlib on Windows?


A convenient way to access the Cernlib libraries is by having a Developer Studio project that includes them in the project/settings/link dialog box. In addition, there are help menu links to the Compaq (formerly Digital) Visual Fortran manuals, the Programmer's Guide being particularly useful on linking procedures.

It is also quite easy to run applications from the command line in a "DOS prompt" window. This statement would compile "your.for", linking with packlib and mathlib to produce an executable "test.exe" -

df -Fetest.exe your.for packlib.lib mathlib.lib kernlib.lib

Geant3 is a bit more complicated but a simple example to produce an executable "g1.exe" would be-

df -Feg1.exe *.f geant321.lib packlib.lib graflib.lib grafX11.lib ix_higz.lib mathlib.lib kernlib.lib

The directory with the Cern libraries should be added to the LIB environment variable, e.g.
set LIB=C:\Program Files\DevStudio\df\lib;C:\Program Files\DevStudio\vc\lib;\2001\new\lib

For windows 95/98, it is unlikely that the Cernlib multithread enabled libraries (*md.lib) and the "shift" versions will work properly. There are README files available with each release with full details of the options used to build Cernlib and notes on problems and special features.

For information on documentation, distribution, pricing, runtime library downloads and other details of Compaq Visual Fortran go to the Compaq Fortran WEB site.


CERN Program Library