The link scripts firstly have to create a subroutine, DTASK_APPLIC, which is called by the ADAM
fixed part and in turn calls the user’s top-level routine. The difference between alink
and ilink
is just
that the template DTASK_APPLIC for alink
contains a call to close down the parameter system after
each invocation of the task unless the environment variable ADAM_TASK_TYPE is set to
‘I’.
If the user’s main routine is written in C, a temporary routine, DTASK_WRAP is created as a Fortran-callable wrapper for the user’s routine. DTASK_APPLIC will call DTASK_WRAP, which in turn calls the user’s routine.
During installation (as part of the DTASK library in the PCS package), the actual compile/link
command within alink/ilink
is edited depending upon the platform and setting of various
environment variables. The template command is:
Notes:
alink/ilink
is
installed.
where:
CC
alink/ilink
script is installed.
$CFLAGS
alink/ilink
is invoked.
$CARGS
-I
or -D
arguments on the alink/ilink
command line, plus, if the
main routine is C, dtask_wrap.c
$EXENAME
is the basename of the prog_module argument of alink/ilink
with any .f
, .c
or .o
suffix removed.
$XDBX
is set to -g
if the -xdbx
argument is given.
$ALINK_FLAGS1
may be set to determine the type of linking required. For instance:
would cause the linker to find the Starlink shared libraries (on platforms where they are installed), thus producing a dynamically linked executable.
$ARGS
is the prog_module argument (with .o
appended if the original extension was not .f
, .c
or .o
) or $EXENAME.o dtask_wrap.o
if the main routine was in C, followed by the
remaining arguments unchanged except that any .c
file extensions are replaced by
.o
.
dtask_link_adam
refers to
DTASK, TASK and ERR libraries directly then invokes subpar_link_adam
which references the
necessary libraries directly, apart from HDS, HLP and PSX whose link_adam scripts are
invoked.
ALINK_FLAGS2
may be useful in controlling the way system libraries are accessed.
Additional system libraries
A platform-dependent list of required system libraries which are
not searched automatically is added to alink/ilink
at installation time.
/star
. In
particular, a -L option is added to include the newly installed libraries before those in /star/lib
.
Similarly with -I options in the C compilation.The -xdbx
argument is provided to overcome some awkward problems which can arise when
debugging ADAM applications. Usually it is sufficient to include -g
in the arguments of alink/ilink
but sometimes, notably when using xdbx
and ups
on SunOS, the debuggers do not behave sensibly if
required source files are missing so the -xdbx
argument should be used instead. The effects of the
argument are:
dtask_main
, the main routine of every ADAM task, is created in
the working directory. The file contains an explanatory message to the user and the name
of the user’s top-level subroutine (which may be helpful in selecting a breakpoint).
-g
is inserted in the compile/link command.