HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
9- 19
The main program procedure can be put into an executable library and
called as an external subunit. If you compile a program from within the
interpreter without specifying the name of the file, the name of the
current program will be the name of the main procedure entry point. If
the current program does not have a name, BBCINP will be the entry point
name. See "Calling External Subunits from Interpreter" later in this
chapter for more details.
Calling Compiled Subunits From the Interpreter
An interpreted program can call a compiled subunit under the following
conditions:
* The compiled subunit and any subunits that it calls must be in an
executable library. Use the link editor to add the relocatable
object file to an executable library. See the
HPLink Editor/XL
Reference Manual
for details. The interpreter can be run using the
XL parameter to specify which executable library to search.
* The interpreted program unit must contain a definition of the
compiled subunit. The subunit uses an EXTERNAL, INTRINSIC or ANYPARM
statement, or it can be implicitly declared in an ANYPARM, underbar,
or call.
An external subunit call is syntactically identical to an internal
subunit call. The CALL statement calls an external procedure, and an
external multi-line function call is legal wherever an internal
multi-line function is legal.
The ON ERROR CALL, ON HALT CALL, and ON END CALL statements cannot
reference external subunits.
An external subunit cannot call an interpreted subunit.
On Call Statements and Compiled Subunits
The following example illustrates the behavior of the ON ERROR CALL
statement across compiled subunit calls. The ON HALT CALL and ON END
CALL statements behave the same way.
Examples
Interpreted Program External Subunits
------------------------------------------------------------------------------------
10 ON ERROR CALL Errsub 100 SUB Extproc
20 GLOBAL EXTERNAL Extproc 110 ON ERROR CALL Blob
30 CALL First_sub 120 CALL Squiggle
. .
. .
. .
500 SUB First_sub 400 SUBEND
. 410 SUB Squiggle
. 420 PRINT 1/0
. 430 .
600 CALL Extproc .
610 PRINT 1/0 .
. 500 SUBEND
. 510 SUB Blob
. .
700 SUBEND .
720 SUB Errsub .
. 590 SUBEND
.
.
800 SUBEND