next up previous
: Running the example : Using CERN Library inside : USROUT

Compiling the executable module

The executable module can be prepared in different ways.
  1. The users routines must be compiled with the fff script:
    $FLUTIL/fff usrini.f
    $FLUTIL/fff histin.f
    $FLUTIL/fff usrout.f
    $FLUTIL/fff mgdraw.f
    

    The resulting objects file can be inserted into a user library, for instance creating the file libuser.a. This is done by means of the command ar:

    ar -r libuser.a usrini.o usrout.o histin.o mgdraw.o
    

    The order of the modules is irrelevant.

    Whenever one of the source file has to be modified, it can be replaced at any time, after compilation, inside libuser.a:

    ar -r libuser.a filename.o
    

    The content of the library file, and the dates of the last update of each module, can be checked by means of the command:

    ar -tv libuser.a
    

    At this point the executable file, which we shall denominate for instance as flukaseamu, can be linked:

    $FLUTIL/lflukac -m fluka -C -O user -o flukaseamu
    

    The option -C is necessary to invoke the link to the CERN library. Warning: Before performing this operation, the user must check that inside the lflukac script the variable CERNPATH points to the actual address of CERN library in the user's machine; for instance:

    CERNPATH=/cern/2001/lib
    

    It is important to adopt the option -O to address the external user library because it contains routines which must be substituted in the original FLUKA library (libflukahp.a).

  2. The executable module can also be prepared avoiding the creation of a user library:
    $FLUTIL/lflukac -m fluka -C usrini.f usrout.f histin.f mgdraw.f -o flukaseamu
    

    or, if the source files have been already compiled by means of $FLUTIL/fff:

    $FLUTIL/lflukac -m fluka -C usrini.o usrout.o histin.o mgdraw.o -o flukaseamu
    

    The order in which the user's file are presented is irrelevant.

    With respect to the case where a user library is is used, this is a more direct way to link the executable, and for simple problems like the one described here, the difference is irrelevant. In cases in which the number of user routines is not so small, the use of a user library is much more convenient and safe, and is strongly recommended.


next up previous
: Running the example : Using CERN Library inside : USROUT
Giuseppe Battistoni 平成17年3月7日