When I compile the following dummy module I cannot address the symbol
"X" in the compiled object file.
MODULE EXPORT
USE ISO_C_BINDING
INTEGER, BIND(C) :: X
CONTAINS
SUBROUTINE DOSTUFF
END SUBROUTINE DOSTUFF
END MODULE EXPORT
Is the symbol "X" optimized away in some way? The function "DOSTUFF"
is
still addressable. I'm using G95 version "gcc version 4.0.3 (g95
0.91!)
Jul 17 2007"
Thank you for clarifications.
Cheers,
--
Henrik Holst
http://www.nada.kth.se/~holst/contact.shtml
int x=5;
you can then add a main program which references X:
program f
use export
write(6, *) ' X is ',x
end program
The bind(c) on objects relies on storage being defined within
C. It works much like an "external" statement in C.
Regards
On Jul 23, 6:26 am, holst <henrikhols...@gmail.com> wrote:
to clarify further on RBader's comment: the bind(c) attribute on
variables can be
used to import C's external variables, not to export Fortran's.