^XTRNL
Provides the value of a link-time symbol
|
|
VSupported on OpenVMS
|
|
^XTRNL(symbol)
Arguments
symbol
A symbol that represents a 32-bit value to be resolved at link time. (D_ADDR)
Discussion
^XTRNL provides the value of a link-time global symbol. The resulting value is resolved and built into the code as a literal at link time.
If ^XTRNL is used to pass a value to a subroutine, it passes the value of the symbol by value as follows:
^VAL(value)
^XTRNL is primarily used to pass arguments to system routines.
Examples
The example below returns the username of the current OpenVMS process.
function get_username record usrnam ,a15 usrnamlen ,i2 d_usrnamlen ,d2 record itmlst buflen ,i2 ,^size(usrnam) itmcod ,i2 bufadr ,i4 retlen ,i4 terminator ,i4 ,0 proc itmcod = ^xtrnl(JPI$_USERNAME) bufadr = ^addr(usrnam) retlen = ^addr(usrnamlen) clear usrnam xcall sys$getjpiw( , , , %ref(itmlst), , , ) freturn(%atrm(usrnam)) endfunction
See %FSTAT Examples for another example of ^XTRNL.