Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: Craig Powers <enigma@xxxxxxxxxx>
- Date: Fri, 14 Mar 2008 09:56:41 -0400
Arjen Markus wrote:
On 14 mrt, 09:37, "FX" <coud...@xxxxxxxxxxxxx> wrote:No, the symbols has to have the same name than the C compiler would giveI don't think the symbol is required to be named "foo", exactlyI think it is: by default it is the lowercase version of the name of
the Fortran variable
to "foo". Systems have different rules for symbol names, for example
MacOS prefixes them with an underscore:
$ cat a.f90
module globals
use iso_c_binding
integer(c_int), bind(c) :: foo
end module globals
$ gfortran -c a.f90 && nm a.o
00000010 C _foo
$ cat b.c
extern int foo;
int main(void){ foo = 0; return 0;}
$ gcc -c b.c && nm b.o
00000024 S ___i686.get_pc_thunk.cx
U _foo
00000000 T _main
--
FX
But that is a "decoration" that is not visible on the C side, is it?
Just like Fortran names often get an underscore appended or get
converted to uppercase. Those name manglings are visible to the linker
and the compiler, they have nothing to do with the source code an
ordinary programmer writes.
(Or maybe I have misinterpreted the question - that happens ;))
We're talking about what appears in the object file, not what's visible to either the Fortran side or the C side.
.
- Follow-Ups:
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: Arjen Markus
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- References:
- BIND(C) EXPORT / IMPORT of Fortran variables
- From: Henrik Holst
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: Craig Powers
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: Arjen Markus
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: FX
- Re: BIND(C) EXPORT / IMPORT of Fortran variables
- From: Arjen Markus
- BIND(C) EXPORT / IMPORT of Fortran variables
- Prev by Date: Re: using iso_c_binding
- Next by Date: Re: What dubugger is used on Linux?
- Previous by thread: Re: BIND(C) EXPORT / IMPORT of Fortran variables
- Next by thread: Re: BIND(C) EXPORT / IMPORT of Fortran variables
- Index(es):
Relevant Pages
|
|