SEARCH [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
SEARCH
SEARCH is an HP Pascal Option.
The SEARCH compiler option specifies one or more files for the compiler
to search for module definitions. The files can be:
* Created with the MLIBRARY compiler option.
* Object files into which the modules were compiled (without the
MLIBRARY compiler option).
* Archives (.a files) of such object files. On MPE/iX, these are RL
files created by the Link Editor using such object files.
You must use the SEARCH option when a module being imported is not
defined within the same compilation unit as the IMPORT statement.
Syntax
$SEARCH string [, string]...$
Parameter
string Has value of the form:
'[+]file_name[, file_name]...'
The compiler searches the file_names (in the order
specified) for module definitions. If + is specified, the
compiler concatenates this list of file names to the
existing list (which was created by previous SEARCH
options). If + is not specified, this list of file names
replaces the existing list. (Note that + can only appear
before the first string.)
An empty string resets the search list to the default.
Default On MPE/iX: PASLIB.PUB.SYS
On HP-UX: /usr/lib/paslib
Module definitions for predefined modules are kept in the
system default module library (paslib), so you do not need
to specify the search options for these modules.
Location Anywhere before the import statement.
Pascal requires that lower level modules be included in the $SEARCH path,
even if the higher level modules do not use them. For example:
module a $search 'a.o'$ $search 'a.o, b.o'$
export module b module c
. import a import b
. export export
. . .
end. . .
. .
end. end.
Example
$SEARCH 'file1,file2','file3'$ {The search list contains file1, file2, file3.}
$SEARCH '+file4'$ {Adds file4 to the search list.}
IMPORT {The search list now contains file4.}
MOD1,MOD2,MOD3;
.
.
.
$SEARCH 'file5,file6', {Replaces old search list.}
'file7,file8'$ {Can span more than one line.}
<rev begin>
IMPORT MOD4; {The search list now contains only file5,}
. {file6, file7, file8.}
<rev end>
.
.
The SEARCH compiler option tells the compiler which files to search for
module definitions. It does not indicate to the linker which files
should be linked with the main program. All object files, or archives
and object files that appear in any search options in the main program
must be explicitly specified to the linker at link time.
Example
Program main(input,output);
$SEARCH `a.o,b.o,c.o'$ {All object files for lower level}
{modules must be included. }
import c;
.
.
.
end.
The object files a.o, b.o, and c.o must be specified to the linker for
the example program to be successfully linked.
MPE/iX 5.0 Documentation