(j3.2006) binding labels and global identifiers
Van Snyder
Van.Snyder
Wed Jun 22 22:44:10 EDT 2011
On Wed, 2011-06-22 at 14:20 -0700, Bill Long wrote:
> This is not the issue. If one has written
>
> subroutine subr()
> end subroutine subr
>
> (not an interface block, but an actual subroutine definition), then
> this and an interface of the form
>
> interface
> subroutine localname() bind(c, name="subr_")
> end subroutine localname
> end interface
>
> have a collision on a Unix system. This is the case that I was hoping
> to see addressed in the interp.
I can think of three answers.
1. The program is conforming; a processor that rejects it isn't. If you
can't get your processor vendor to fix the problem, work around it
yourself. We advise you not to use binding labels that look remotely
like Fortran identifiers for any global Fortran entities of your
program.
2. The program isn't conforming because a processor is free to invent
linker names in any way it likes. It's up to you to psych out their
algorithm, and all the other algorithms that other processors have used
or might use in the future, and then avoid the problems those algorithms
cause.
3. The question is outwith the scope of the standard. We advise you
not to use binding labels that look remotely like Fortran identifiers
for any global Fortran entities of your program.
Reading the interp answer, and throwing up your hands in despair, you
might try
interface
subroutine localname() bind(c, name="subr__")
end subroutine localname
end interface
and discover it works on Unix with one compiler, but fails for exactly
the same reason the first one failed, on a different platform. So then
you try
interface
subroutine localname() bind(c, name="_subr_")
end subroutine localname
end interface
being briefly joyful at your success, only to need to try
interface
subroutine localname() bind(c, name="_subr__")
end subroutine localname
end interface
later. Perhaps you will then meet an old sailor who can teach you some
words to which your mother would object, with which to describe the
situation.
More information about the J3
mailing list