Next: Specification of Data Type
Up: C Language Bindings
Previous: C Language Bindings
If a user wishes to specify that a procedure is defined by a C
procedure, this is specified with an extrinsic-spec-arg of
LANGUAGE = "0DC"0D,
or an extrinsic-kind-keyword of C, as specified in
Section 6.
For C subprograms for which
EXTRINSIC (LANGUAGE = "0DC"0D) has been specified, the
constraints associated
with the syntax for attr-spec-extended
(H1102) are extended as follows:
- A LANGUAGE = "0DC"0D function shall have a scalar
result
of type integer, real or double precision.
- A dummy argument of a LANGUAGE = "0DC"0D procedure
shall
not be an assumed-shape array, shall not have the
POINTER attribute, shall not have
the TARGET attribute, nor shall it have a subobject that
has the POINTER attribute.
- The bounds of a dummy argument shall not be specified by
specification expressions that are not constant specification
expressions, nor shall the character length parameter of a dummy
argument of such a procedure be specified by a specification
expression that is not a constant specification expression.
- A dummy-arg-list of a LANGUAGE = "0DC"0D
subroutine
shall not have a dummy-arg that is * or a
dummy procedure.
The value of the scalar-char-initialization-expr in the
EXTERNAL_NAME specifier gives the name of the procedure as
defined in C. This value need not be the same as the procedure name
specified by the function-stmt or subroutine-stmt.
If EXTERNAL_NAME is not specified, it is as if it were
specified with a value that is the same as the procedure name in
lower case letters.
-
- Advice to users.Note that the EXTERNAL_NAME specifier does not necessarily specify
the name by which a binder knows the procedure. It specifies the name by
which the procedure would be known if it were referenced by a C program,
and the HPF compiler is required to perform any transformations of that
name that the C compiler would perform.
The EXTERNAL_NAME specifier also allows the user to specify a name
that might not be permitted by an HPF compiler, such as a name beginning
with an underscore, or as a way of enforcing the distinction between upper
and lower case characters in the name.
(End of advice to users.)
The extrinsic-spec-arg of LANGUAGE = "0DC"0D helps
a
compiler identify a procedure that is defined in C so that it can
take appropriate steps to ensure that the procedure is invoked in the
manner required by the C compiler.
-
- Advice
to implementors.A vendor may feel compelled to provide support for more than one C
compiler, if different C compilers available for a system provide
different procedure calling conventions or different data type
sizes. For instance, a vendor's compiler may provide support for a
value of GNU_C in the LANGUAGE= specifier, or it
may provide support through the use of compiler switches.
(End of advice to implementors.)
Next: Specification of Data Type
Up: C Language Bindings
Previous: C Language Bindings