(j3.2006) Interesting F2003-ism

Andy Vaught andyv
Wed Feb 21 21:41:06 EST 2007

I had a user send in an interesting code the other day.  It looked
something like:

    subroutine p1(f, a) bind(c, name='printf')
      type(c_ptr) :: f
      integer, value :: a
    end subroutine p1

    subroutine p2(f, b) bind(c, name='printf')
      type(c_ptr) :: f
      real, value :: b
    end subrouitine p2
  end interface

  Apparently, section 16.1 forbids this, because there are two entities
with the same binding label, which are global entities.  The gist of 16.1
is "thy program shall link", but the restriction against using the same
binding label here seems overly strict.  It is the only way that one can
directly call a C subroutine with a variable argument list.

  Is this what was intended in 16.1?


More information about the J3 mailing list