-qbindcextname

Category

Portability and migration

Purpose

Controls whether the -qextname option affects BIND(C) entities.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-bindcextname---.   
>>- -q--+-nobindcextname-+-------------------------------------><

@PROCESS:

@PROCESS BINDCEXTNAME | NOBINDCEXTNAME

Defaults

-qbindcextname

Usage

The -qextname option and the BIND(C) attribute are two ways of modifying the names of Fortran global entities to facilitate use in C.

If you explicitly specify a BIND(C) binding label in an interface block using the NAME= specifier, the compiler uses this binding label in calls to the procedure regardless of the -qextname and -qbindcextname options.

If your interface does not explicitly specify a BIND(C) binding label using the NAME= specifier, the compiler creates an implicit binding label. If you also specify the -qextname option, the compiler appends an underscore to the implicit binding label only when the -qbindcextname option is in effect.

If you specify the -qextname and -qbindcextname options for a compilation unit declaring a BIND(C) procedure, the compiler appends an underscore to the binding label, even when the binding label is explicitly specified.

Notes:
  • You must ensure that the names of a BIND(C) entity are identical. Accordingly, if two compilation units access the same BIND(C) entity that does not have an explicitly-specified binding label, you must not compile one unit with the -qbindcextname option and the other with the -qnobindcextname option.
  • The -q[no]bindcextname option has effect only if the -qextname option is also specified. If the -qextname option is specified with a list of named entities, the -q[no]bindcextname option only affects these named entities.

Examples

interface
    integer function foo() bind(c)
    end funciton
    integer function bar()
    end function
end interface

print *, foo()
print *, bar()
end

xlf90 x.f -qextname -qbindcextname         # calls "foo_", and "bar_"
xlf90 x.f -qextname -qnobindcextname       # calls "foo", and "bar_"
xlf90 x.f -qextname=foo -qbindcextname     # calls "foo_", and "bar"
xlf90 x.f -qextname=foo -qnobindcextname   # calls "foo", and "bar"
xlf90 x.f                                  # calls "foo", and "bar"
xlf90 x.f -qnobindcextname                 # calls "foo", and "bar"

Related information