Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Bind(C) with multiple variables

abhimodak
New Contributor I
328 Views

Is there something to specify the name-case for multiple variables using Bind(C)? For example,

Module OM

Use ISO_C_Binding

Implicit None

Integer, Protected, Bind(C) :: iVar = 1, jVar = 2

End Module OM

When the iVar and jVar are picked up on the C-side they will all be lowercase. I believe --to enforce the name case, one can write one line for each variable like

Integer, Protected, Bind(C,Name='iVar') :: iVar = 1

Integer, Protected, Bind(C,Name='jVar') :: jVar = 2

There will be n such lines for n variable. I am wondering if there something (attribute) so that only one line is needed? For example, 

Integer, Protected, Bind(C), someAttributeEnforcingTheNameCase :: iVar, jVar

Abhi

0 Kudos
1 Reply
FortranFan
Honored Contributor II
322 Views

Current Fortran standard (2018) offers no such attribute.

Re: lowercase, you may take note the standard confirms what you believe, "If a variable or common block has the BIND attribute specified without a NAME= specifier, the binding label is the same as the name of the entity using lower case letters"

0 Kudos
Reply