[J3] Is BIND (C [ , NAME = scalar-default-char-constant-expr ]) where scalar-default-char-constant-expr has zero length legal?
Vipul Parekh
parekhvs at gmail.com
Wed Jan 9 11:55:49 EST 2019
On Wed, Jan 9, 2019 at 11:27 AM Daniel C Chen via J3 <
j3 at mailman.j3-fortran.org> wrote:
> ..
>
> Based on the wording in the standard that Bill pointed out,
> 1. subroutine 'foo' has the BIND attribute, but no binding label. So 'foo'
> can be called within Fortran, but 'foo' must not be referenced in C due to
> lack of a binding label.
> 2. If "subroutine foo() bind(c, name='')" is in an interface, Fortran
> cannot call a C routine named 'foo' as well.
>
Re: 1. and "'foo' must not be referenced in C due to lack of a binding
label", will it not be platform and processor-dependent? I can't recall
anything in the Fortran standard that prohibits this.
For a subroutine 'foo' in Fortran shown earlier with the BIND attribute but
no binding label, a C program such as
extern void sub( void );
void main() {
sub();
return;
}
works with one processor whereas
extern void sub_( void );
void main() {
sub();
return;
}
works with the other. That is the companion processor and linker are able
to function alright with the Fortran procedure label.
Regards,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190109/e6945ae4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190109/e6945ae4/attachment.gif>
More information about the J3
mailing list