HPlogo HP Assembler Reference Manual: HP 9000 Computers > Chapter 4 Assembler Directives and Pseudo-Operations

.IMPORT Directive

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The .IMPORT directive allows symbols to be defined in one program but used in other programs.

Syntax

.IMPORT symbol [, type] [, TSPECIFIC]

Parameters

symbol

The name of an identifier whose definition is being imported.

type

A linker symbol type that can take one of the following values:

Title not available (Parameters )

ABSOLUTE

Designates an absolute symbol.

DATA

Designates a data symbol.

CODE

Designates a code location. The location can not be a procedure entry.

ENTRY

Designates the entry point of a procedure.

MILLICODE

Locates code for the entry point of a millicode routine.

MILLI_EXT

Locates code for the entry point of an external millicode routine.

PLABEL

Locates a pointer to a procedure.

PRI_PROG

Designates the primary program entry point. The outer block of HP Pascal/HP-UX and the main program in HP FORTRAN 77/HP-UX are type PRI_PROG.

SEC_PROG

Designates a secondary program entry point.

TSPECIFIC

The TSPECIFIC keyword indicates that this is a thread local storage symbol.

Discussion

The .IMPORT directive uses a series of keywords to define a symbol to the linker. These keywords declare the symbol's type. Because the .IMPORT directive specifies that another object module contains this symbol's formal definition, the Assembler does not associate an imported symbol with any particular subspace. When an .IMPORT directive lacks a type parameter, the Assembler assigns the type of the current subspace (either $CODE$ or $DATA$) to the symbol.

Example

The .IMPORT directive lets the Assembler access symname as a recognized symbol, even though it is actually defined elsewhere. The linker resolves the difference.

.IMPORT symname,CODE           ;import symname as a CODE symbol.
.CODE ;begin CODE subspace
LDIL L'symname,%r1
BLE,n R'symname(%sr4,%r1) ;call the procedure symname in %sr4 space.
NOP
.END
© 1998 Hewlett-Packard Development Company, L.P.