This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question on bind(c) global vars


i've added a test that ensures a variable is declared at the module level
if it is bind(c).  it does not apply to subroutines/functions, or common
blocks.  however, i wrote a dejagnu test for it and i am still not getting
the dg-error syntax to work correctly.  i'm sure i'm missing something
simple, so if anyone can help, i would appreciate it.  i've attached the
test case and the output from gfortran.

Thanks.
Chris

> i'm working on the bugs listed on the wiki for iso_c_binding, and i have a
> question on this one:
>
> "Bind(C) variables are only allowed in modules specification, gfortran
> accepts them also in the program part. "15.3 Interoperation with C global
> variables -- A C variable with external linkage may interoperate with a
> common block or with a variable declared in the scope of a module. The
> common block or variable shall be specified to have the BIND attribute.""
>
> does this apply to subroutines and functions also?  right now, i allow a
> separate source file to have subroutine decls that can be bind(c).  do
> these have to be contained within a module in order to be bind(c).  just
> fyi, i intentionally allowed bind(c) on routines that were not declared
> within a module, but i thought i was enforcing variables to be declared
> within a module or be a common block.  i know i check that dummys are not
> declared bind(c), but i apparently am missing the check on normal
> variables.
>
> thanks.
> Chris
>
>
>

Attachment: bind_c_usage_2.f03
Description: Binary data

Attachment: bind_c_usage_2.out
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]