VMS Help  —  FORTRAN  Statements  Directives  General Directives, ATTRIBUTES
  cDEC$ ATTRIBUTES

  Lets you specify properties for data objects and procedures.  It
  takes the following form:

  cDEC$ ATTRIBUTES att [,att]... :: object [,object]...

    c        Is one of the following: C (or c), !, or *.

    att      Is one of the following properties:

             ADDRESS64
             ALIAS                        EXTERN
             ALLOW_NULL                   IGNORE_LOC
                                          NO_ARG_CHECK
             C                            NOMIXED_STR_LEN_ARG
             DECORATE                     REFERENCE
             DEFAULT                      REFERENCE32
             DESCRIPTOR                   REFERENCE64
             DESCRIPTOR32                 STDCALL
             DESCRIPTOR64                 VALUE
                                          VARYING

    object   Is the name of a data object or procedure.

  The properties can be used in function and subroutine definitions,
  in type declarations, and with the INTERFACE and ENTRY statements.

  Properties applied to entities available through use or host
  association are in effect during the association.  For example,
  consider the following:

  MODULE MOD1
    INTERFACE
      SUBROUTINE SUB1
      !DEC$ ATTRIBUTES C, ALIAS:'othername' :: NEW_SUB
      END SUBROUTINE
    END INTERFACE
    CONTAINS
      SUBROUTINE SUB2
      CALL NEW_SUB
      END SUBROUTINE
  END MODULE

  In this case, the call to NEW_SUB within SUB2 uses the C and ALIAS
  properties specified in the interface block.

  Options C, STDCALL, REFERENCE, VALUE, and VARYING affect the
  calling conventions of routines:

   o  You can specify C, STDCALL, REFERENCE, and VARYING for an
      entire routine.

   o  You can specify VALUE and REFERENCE for individual arguments.

  For compatibility, !MS$ATTRIBUTES can be used in place of cDEC$
  ATTRIBUTES.

  The properties are described in the following sections.

1  –  ADDRESS64

  Specifies that the data object has a 64-bit address.  This property
  can be specified for any variable or dummy argument, including
  ALLOCATABLE and deferred-shape arrays.  However, variables with
  this property cannot be data-initialized.

  It can also be specified for COMMON blocks or for variables in a
  COMMON block.  If specified for a COMMON block variable, the COMMON
  block implicitly has the ADDRESS64 property.

  ADDRESS64 is not compatible with the AUTOMATIC attribute.

2  –  ALIAS

  Specifies an alternate external name to be used when referring to
  external subprograms.  Its form is:

  ALIAS:external-name

    external-name  Is a character constant delimited by apostrophes
                   or quotation marks.  The character constant is
                   used as is; the string is not changed to uppercase,
                   nor are blanks removed.

  The ALIAS property overrides the C (and STDCALL) property.  If both
  C and ALIAS are specified for a subprogram, the subprogram is given
  the C calling convention, but not the C naming convention.  It
  instead receives the name given for ALIAS, with no modifications.

  ALIAS cannot be used with internal procedures, and it cannot be
  applied to dummy arguments.

  cDEC$ ATTRIBUTES ALIAS has the same effect as the cDEC$ ALIAS
  directive.

3  –  ALLOW_NULL

  Enables a corresponding dummy argument to pass a NULL pointer
  (defined by a zero or the NULL intrinsic function) by value for the
  argument.

  ALLOW_NULL is only valid if the REFERENCE property is also
  specified; otherwise, it has no effect.

4  –  C and STDCALL

  Specify how data is to be passed when you use routines written in C
  or assembler with FORTRAN or Fortran 95/90 routines.

  C and STDCALL are interpreted as synonyms.

  When applied to a subprogram, these properties define the
  subprogram as having a specific set of calling conventions.

  The difference between the calling conventions is this: If C or
  STDCALL is specified for a subprogram, arguments (except for
  arrays and characters) are passed by value.  Subprograms using
  standard Fortran 95/90 conventions pass arguments by reference.

  Character arguments are passed as follows:

   o  By default, hidden lengths are put at the end of the argument
      list.

   o  If C or STDCALL (only) is specified:

      On all systems, the first character of the string is passed
      (and padded with zeros out to INTEGER(4) length).

   o  If C or STDCALL is specified, and REFERENCE is specified for
      the argument:

      On all systems, the string is passed with no length.

   o  If C or STDCALL is specified, and REFERENCE is specified for
      the routine (but REFERENCE is not specified for the argument,
      if any):

      On all systems, the string is passed with the length.

5  –  DECORATE

  Specifies that the external name used in cDEC$ ALIAS or cDEC$
  ATTRIBUTES ALIAS should have the prefix and postfix decorations
  performed on it that are associated with the calling mechanism that
  is in effect.  These are the same decorations performed on the
  procedure name when ALIAS is not specified.

  The case of the external name is not modified.

  If ALIAS is not specified, this property has no effect.

6  –  DEFAULT

  Overrides certain compiler options that can affect external routine
  and COMMON block declarations.

  It specifies that the compiler should ignore compiler options that
  change the default conventions for external symbol naming and
  argument passing for routines and COMMON blocks (/iface, /names,
  and /assume:underscore).

  This option can be combined with other cDEC$ ATTRIBUTES options,
  such as STDCALL, C, REFERENCE, ALIAS, etc.  to specify attributes
  different from the compiler defaults.

  This option is useful when declaring INTERFACE blocks for external
  routines, since it prevents compiler options from changing calling
  or naming conventions.

7  –  DESCRIPTOR

  Specifies that the argument is passed by VMS descriptor.  This
  property can be specified only for dummy arguments in an INTERFACE
  block (NOT for a routine itself).

8  –  DESCRIPTOR32

  Specifies that the argument is passed as a 32-bit descriptor.

9  –  DESCRIPTOR64

  Specifies that the argument is passed as a 64-bit descriptor.

10  –  EXTERN

  Specifies that a variable is allocated in another source file.
  EXTERN can be used in global variable declarations, but it must not
  be applied to dummy arguments.

  EXTERN must be used when accessing variables declared in other
  languages.

11  –  IGNORE_LOC

  Enables %LOC to be stripped from an argument.

  IGNORE_LOC is only valid if the REFERENCE property is also
  specified; otherwise, it has no effect.

12  –  NO_ARG_CHECK

  Specifies that type and shape matching rules related to explicit
  interfaces are to be ignored.  This permits the construction of an
  INTERFACE block for an external procedure or a module procedure
  that accepts an argument of any type or shape; for example, a
  memory copying routine.

  NO_ARG_CHECK can appear only in an INTERFACE block for a
  non-generic procedure or in a module procedure.  It can be applied
  to an individual dummy argument name or to the routine name, in
  which case the property is applied to all dummy arguments in that
  interface.

  NO_ARG_CHECK cannot be used for procedures with the PURE or
  ELEMENTAL prefix.  If an argument has an INTENT or OPTIONAL
  attribute, any NO_ARG_CHECK specification is ignored.

13  –  NOMIXED_STR_LEN_ARG

  Specifies that hidden lengths be placed in sequential order at the
  end of the argument list.

14  –  REFERENCE and VALUE

  Specify how a dummy argument is to be passed.

  REFERENCE specifies a dummy argument's memory location is to be
  passed instead of the argument's value.

  VALUE specifies a dummy argument's value is to be passed instead of
  the argument's memory location.

  When a dummy argument has the VALUE property, the actual argument
  passed to it can be of a different type.  If necessary, type
  conversion is performed before the subprogram is called.

  When a complex (KIND=4, KIND=8, or KIND=16) argument is passed by
  value, two floating-point arguments (one containing the real part,
  the other containing the imaginary part) are passed by immediate
  value.

  Character values, substrings, assumed-size arrays, and adjustable
  arrays cannot be passed by value.

  If REFERENCE (only) is specified for a character argument, the
  string is passed but the length is not passed.

  If REFERENCE is specified for a character argument, and C (or
  STDCALL) has been specified for the routine, the string is passed
  but the length is not passed.  This is true even if REFERENCE is
  also specified for the routine.

  If REFERENCE and C (or STDCALL) are specified for a routine, but
  REFERENCE has not been specified for the argument, the string is
  passed with the length.

  VALUE is the default if the C or STDCALL property is specified in
  the subprogram definition.

15  –  REFERENCE32

  Specifies that the argument is accepted only by 32-bit address.

16  –  REFERENCE64

  Specifies that the argument is accepted only by 64-bit address.

17  –  VARYING

  Allows a variable number of calling arguments.  If VARYING is
  specified, the C property must also be specified.

  Either the first argument must be a number indicating how many
  arguments to process, or the last argument must be a special marker
  (such as -1) indicating it is the final argument.  The sequence of
  the arguments, and types and kinds must be compatible with the
  called procedure.
Close Help