Next: , Previous: Pragma Import_Procedure, Up: Implementation Defined Pragmas


Pragma Import_Valued_Procedure

Syntax:

     pragma Import_Valued_Procedure (
          [Internal                 =>] LOCAL_NAME
       [, [External                 =>] EXTERNAL_SYMBOL]
       [, [Parameter_Types          =>] PARAMETER_TYPES]
       [, [Mechanism                =>] MECHANISM]
       [, [First_Optional_Parameter =>] IDENTIFIER]);
     
     EXTERNAL_SYMBOL ::=
       IDENTIFIER
     | static_string_EXPRESSION
     
     PARAMETER_TYPES ::=
       null
     | TYPE_DESIGNATOR {, TYPE_DESIGNATOR}
     
     TYPE_DESIGNATOR ::=
       subtype_NAME
     | subtype_Name ' Access
     
     MECHANISM ::=
       MECHANISM_NAME
     | (MECHANISM_ASSOCIATION {, MECHANISM_ASSOCIATION})
     
     MECHANISM_ASSOCIATION ::=
       [formal_parameter_NAME =>] MECHANISM_NAME
     
     MECHANISM_NAME ::=
       Value
     | Reference
     | Descriptor [([Class =>] CLASS_NAME)]
     | Short_Descriptor [([Class =>] CLASS_NAME)]
     
     CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca

This pragma is identical to Import_Procedure except that the first parameter of LOCAL_NAME, which must be present, must be of mode OUT, and externally the subprogram is treated as a function with this parameter as the result of the function. The purpose of this capability is to allow the use of OUT and IN OUT parameters in interfacing to external functions (which are not permitted in Ada functions). You may optionally use the Mechanism parameters to specify passing mechanisms for the parameters. If you specify a single mechanism name, it applies to all parameters. Otherwise you may specify a mechanism on a parameter by parameter basis using either positional or named notation. If the mechanism is not specified, the default mechanism is used.

Note that it is important to use this pragma in conjunction with a separate pragma Import that specifies the desired convention, since otherwise the default convention is Ada, which is almost certainly not what is required.