Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Biology grows on you.


devel / comp.lang.fortran / Re: BIND(C) on module procedure

SubjectAuthor
* BIND(C) on module procedurepmk
+- Re: BIND(C) on module procedurepmk
`* Re: BIND(C) on module procedureThomas Koenig
 `* Re: BIND(C) on module procedurepmk
  `- Re: BIND(C) on module procedurepmk

1
BIND(C) on module procedure

<8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2363&group=comp.lang.fortran#2363

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1a86:b0:304:e304:4ab1 with SMTP id s6-20020a05622a1a8600b00304e3044ab1mr1443936qtc.424.1655152316341;
Mon, 13 Jun 2022 13:31:56 -0700 (PDT)
X-Received: by 2002:a5b:14f:0:b0:656:b905:7cb4 with SMTP id
c15-20020a5b014f000000b00656b9057cb4mr1494583ybp.386.1655152316128; Mon, 13
Jun 2022 13:31:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 13 Jun 2022 13:31:55 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=hzJ1nwoAAACS3IxtuAkjIfQoNdylflgH
NNTP-Posting-Host: 12.154.207.45
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>
Subject: BIND(C) on module procedure
From: pmklausler@gmail.com (pmk)
Injection-Date: Mon, 13 Jun 2022 20:31:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: pmk - Mon, 13 Jun 2022 20:31 UTC

What is the binding name of a module procedure supposed to be when no NAME= appears? Every compiler that I try applies some kind of name mangling that combines the module name with the procedure name in a distinct fashion for each compiler. And yet the standard seems to be pretty clear that the default binding name is just the procedure name in lower case. Are all the compilers non-conforming, or have I missed something in the standards?

Re: BIND(C) on module procedure

<7893395d-8c13-4817-ab12-4d0e3817f77en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2365&group=comp.lang.fortran#2365

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:4724:b0:6a7:45b3:c9c8 with SMTP id bs36-20020a05620a472400b006a745b3c9c8mr1667262qkb.464.1655155312283;
Mon, 13 Jun 2022 14:21:52 -0700 (PDT)
X-Received: by 2002:a05:6902:1023:b0:665:12c1:b44d with SMTP id
x3-20020a056902102300b0066512c1b44dmr1702066ybt.472.1655155312081; Mon, 13
Jun 2022 14:21:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 13 Jun 2022 14:21:51 -0700 (PDT)
In-Reply-To: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=hzJ1nwoAAACS3IxtuAkjIfQoNdylflgH
NNTP-Posting-Host: 12.154.207.45
References: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7893395d-8c13-4817-ab12-4d0e3817f77en@googlegroups.com>
Subject: Re: BIND(C) on module procedure
From: pmklausler@gmail.com (pmk)
Injection-Date: Mon, 13 Jun 2022 21:21:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1888
 by: pmk - Mon, 13 Jun 2022 21:21 UTC

On Monday, June 13, 2022 at 1:31:57 PM UTC-7, pmk wrote:
> What is the binding name of a module procedure supposed to be when no NAME= appears? Every compiler that I try applies some kind of name mangling that combines the module name with the procedure name in a distinct fashion for each compiler. And yet the standard seems to be pretty clear that the default binding name is just the procedure name in lower case. Are all the compilers non-conforming, or have I missed something in the standards?

More information: this all seems to work as expected with "BIND(C)", but not with "BIND(C,NAME='')" -- i.e., with an empty or blank name. But that case should be the same as "BIND(C)", yes?

Re: BIND(C) on module procedure

<t88cah$pog$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2366&group=comp.lang.fortran#2366

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-30b7-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: BIND(C) on module procedure
Date: Mon, 13 Jun 2022 22:05:05 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t88cah$pog$1@newsreader4.netcologne.de>
References: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>
Injection-Date: Mon, 13 Jun 2022 22:05:05 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-30b7-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:30b7:0:7285:c2ff:fe6c:992d";
logging-data="26384"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 13 Jun 2022 22:05 UTC

pmk <pmklausler@gmail.com> schrieb:
> What is the binding name of a module procedure supposed to be
> when no NAME= appears? Every compiler that I try applies some kind
> of name mangling that combines the module name with the procedure
> name in a distinct fashion for each compiler. And yet the standard
> seems to be pretty clear that the default binding name is just the
> procedure name in lower case. Are all the compilers non-conforming,
> or have I missed something in the standards?

If you use BIND(C) in lowercase, then the name of the procedure
is the one you specified, in lowercase.

Example:

$ cat bind.f90
module x
contains
subroutine foo() bind(c)
end subroutine foo
end module x
$ gfortran -c bind.f90
$ nm bind.o
0000000000000000 T foo
$ nagfor -c bind.f90
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7101
[NAG Fortran Compiler normal termination]
$ nm bind.o
0000000000000000 T foo
U _GLOBAL_OFFSET_TABLE_
0000000000000000 b __NAGf90_DefIO_3_Read
0000000000000020 b __NAGf90_DefIO_3_Write
0000000000000020 C x_

Both compilers correctly use "foo" as the binding name.

What you observed probably was the "normal" name mangling, without
bind(c). That is indeed compiler dependent.

Re: BIND(C) on module procedure

<b40ccdcf-6433-4c2c-9138-e83bd67c7201n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2367&group=comp.lang.fortran#2367

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:7d55:0:b0:305:732:680b with SMTP id h21-20020ac87d55000000b003050732680bmr1849560qtb.391.1655160305819;
Mon, 13 Jun 2022 15:45:05 -0700 (PDT)
X-Received: by 2002:a81:a243:0:b0:30c:37ed:52ff with SMTP id
z3-20020a81a243000000b0030c37ed52ffmr2251000ywg.508.1655160305682; Mon, 13
Jun 2022 15:45:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 13 Jun 2022 15:45:05 -0700 (PDT)
In-Reply-To: <t88cah$pog$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=hzJ1nwoAAACS3IxtuAkjIfQoNdylflgH
NNTP-Posting-Host: 12.154.207.45
References: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com> <t88cah$pog$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b40ccdcf-6433-4c2c-9138-e83bd67c7201n@googlegroups.com>
Subject: Re: BIND(C) on module procedure
From: pmklausler@gmail.com (pmk)
Injection-Date: Mon, 13 Jun 2022 22:45:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2259
 by: pmk - Mon, 13 Jun 2022 22:45 UTC

What has me concerned is that the behavior of BIND(C,NAME='') is not the same as BIND(C) with no NAME= at all.

$ cat module-binding-1.f90
module m
contains
subroutine foo() bind(c,name='')
print *, 'works'
end subroutine
end module
$ cat module-binding-2.f90
program test
interface
subroutine foo() bind(c,name='')
end subroutine
end interface
call foo
end program
$ gfortran -c module-binding-[12].f90
$ nm module-binding-[12].o

module-binding-1.o:
U _GLOBAL_OFFSET_TABLE_
0000000000000000 T __m_MOD_foo
U _gfortran_st_write
U _gfortran_st_write_done
U _gfortran_transfer_character_write

module-binding-2.o:
0000000000000000 t MAIN__
U _GLOBAL_OFFSET_TABLE_
U _gfortran_set_args
U _gfortran_set_options
U foo_
000000000000000c T main
0000000000000000 r options.0.3877
$ gfortran module-binding-[12].o
/usr/bin/ld: module-binding-2.o: in function `MAIN__':
module-binding-2.f90:(.text+0x5): undefined reference to `foo_'

Re: BIND(C) on module procedure

<128d25d8-b4df-40bb-b6ba-1e8944ab09cdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2368&group=comp.lang.fortran#2368

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5790:0:b0:305:bd1:f7b0 with SMTP id v16-20020ac85790000000b003050bd1f7b0mr1909385qta.94.1655161133011;
Mon, 13 Jun 2022 15:58:53 -0700 (PDT)
X-Received: by 2002:a81:4ccb:0:b0:30c:71ba:6e1a with SMTP id
z194-20020a814ccb000000b0030c71ba6e1amr2171035ywa.431.1655161132878; Mon, 13
Jun 2022 15:58:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 13 Jun 2022 15:58:52 -0700 (PDT)
In-Reply-To: <b40ccdcf-6433-4c2c-9138-e83bd67c7201n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=hzJ1nwoAAACS3IxtuAkjIfQoNdylflgH
NNTP-Posting-Host: 12.154.207.45
References: <8a3fd306-c815-46a4-88e9-9dba474e4aafn@googlegroups.com>
<t88cah$pog$1@newsreader4.netcologne.de> <b40ccdcf-6433-4c2c-9138-e83bd67c7201n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <128d25d8-b4df-40bb-b6ba-1e8944ab09cdn@googlegroups.com>
Subject: Re: BIND(C) on module procedure
From: pmklausler@gmail.com (pmk)
Injection-Date: Mon, 13 Jun 2022 22:58:53 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1511
 by: pmk - Mon, 13 Jun 2022 22:58 UTC

On Monday, June 13, 2022 at 3:45:07 PM UTC-7, pmk wrote:
> What has me concerned is that the behavior of BIND(C,NAME='') is not the same as BIND(C) with no NAME= at all.

Oh, ok, I understand that text in 18.0.2 now. In the case of BIND(C,NAME=''), *there is no binding label*. Never mind!

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor