Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

J.15.5 Interfacing Pragmas


An interfacing pragma is a representation pragma that is one of the pragmas Import, Export, or Convention. Their forms are as follows: 
  pragma Import(
     [Convention =>] convention_identifier, [Entity =>] local_name
  [, [External_Name =>] external_name_string_expression]
  [, [Link_Name =>] link_name_string_expression]);
  pragma Export(
     [Convention =>] convention_identifier, [Entity =>] local_name
  [, [External_Name =>] external_name_string_expression]
  [, [Link_Name =>] link_name_string_expression]);
  pragma Convention([Convention =>] convention_identifier,[Entity =>] local_name);
For pragmas Import and Export, the argument for Link_Name shall not be given without the pragma_argument_identifier unless the argument for External_Name is given. 

Name Resolution Rules

The expected type for an external_name_string_expression and a link_name_string_expression in an interfacing pragma is String. 

Legality Rules

The convention_identifier of an interfacing pragma shall be the name of a convention (see B.1).
A pragma Import shall be the completion of a declaration. Notwithstanding any rule to the contrary, a pragma Import may serve as the completion of any kind of (explicit) declaration if supported by an implementation for that kind of declaration. If a completion is a pragma Import, then it shall appear in the same declarative_part, package_specification, task_definition, or protected_definition as the declaration. For a library unit, it shall appear in the same compilation, before any subsequent compilation_units other than pragmas. If the local_name denotes more than one entity, then the pragma Import is the completion of all of them.
The external_name_string_expression and link_name_string_expression of a pragma Import or Export shall be static.
 The local_name of each of these pragmas shall denote a declaration that may have the similarly named aspect specified. 

Static Semantics

 An interfacing pragma specifies various aspects of the entity denoted by the local_name as follows: 
The Convention aspect (see B.1) is convention_identifier.
A pragma Import specifies that the Import aspect (see B.1) is True.
A pragma Export specifies that the Export aspect (see B.1) is True.
For both pragma Import and Export, if an external name is given in the pragma, the External_Name aspect (see B.1) is specified to be external_name_string_expression. If a link name is given in the pragma, the Link_Name aspect (see B.1) is specified to be the link_name_string_expression.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe