VMS Help  —  MACRO  /ALPHA  Supplied Library Macros, Using the $CALL Macro
    $CALL calls local or external routines previously defined by the
    $ROUTINE macro or defined in another language.

    To call a routine using standard linkage, use the $CALL macro.
    You invoke this macro from within the routine's code section.
    $CALL performs the following actions:

    o  Searches a list of linkage pairs referenced in previous
       invocations of the $CALL and $LINKAGE_PAIR macros within
       the calling routine. If a linkage pair is already found to
       exist on the list, $CALL uses the linkage pair stored from the
       previous invocation. Otherwise, $CALL stores the linkage pair
       of the called routine in the caller's linkage section and adds
       the linkage pair to the caller's list.

    o  Allocates stack space for arguments, if necessary.

    o  Loads arguments specified with the ARGS argument into argument
       registers and onto the stack, as appropriate.

    o  Sets the arguments information register, R25, according to the
       arguments specified with ARGS argument.

    o  Generates the following instruction sequence to perform
       the actual call based on the location of the linkage pair
       generated from above, and the value of Rls, linkage register,
       which is assumed to point to the base of the linkage section:

             LDQ R26, code_addr_offset(Rls)      ; load code address
             LDQ R27, proc_desc_addr_offset(Rls) ; load procedure
                                                 ; descriptor address
                                                 ;
             JSR R26, R26                        ; Jump to the routine
                                                 ;  saving the return
                                                 ;  address in R26

    o  Frees argument stack space, if any, and if the called routine
       does not return a value on the stack.

       Like $ROUTINE, the $CALL macro invokes other macros to perform
       the previous tasks.

       If you do not specify the Rls argument in your invocation of
       $CALL, $CALL assumes that you have used the .BASE directive
       to define a register that points to the base address of your
       linkage section. That is, it assumes that you have included a
       statement similar to the following:

       .BASE R27, $LS

       This source statement defines the base address of the linkage
       section to be R27, and to be associated with the macro symbol
       $LS. This source statement should be placed in your source
       code before the $CALL macro call.
Additional Information: explode extract
Using $CALL in Source Code
Close Help