This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: fortran 90 passing user defined type member to a c fucntion
- From: burlen <burlen dot loring at gmail dot com>
- To: Toon Moene <toon at moene dot org>
- Cc: ian Lance Taylor <iant at google dot com>, gfortran <fortran at gcc dot gnu dot org>
- Date: Sat, 27 Mar 2010 15:29:40 -0700
- Subject: Re: fortran 90 passing user defined type member to a c fucntion
- References: <4BAD0026.5010909@gmail.com> <mcrwrwyr70n.fsf@dhcp-172-17-9-151.mtv.corp.google.com> <4BAE42FF.7020200@gmail.com> <4BAE5FB5.4000209@moene.org>
Toon Moene wrote:
burlen wrote:
In my understanding, Fortran unless otherwise instructed is supposed
to pass by address. In the c function modifying the data pointed to
should do just that, and be visible to the caller. What I don't
understand is why passing the member of a user defined type behaves
as if it's passed by value in this case, while passing the
corresponding native type is passed by address and works as expected.
Your understanding is ... limited ... (I hesitate to say "wrong",
because lots of Fortran compilers implement argument passing the way
you describe it).
Please direct GNU Fortran questions to the appropriate forum
(fortran@gcc.gnu.org).
Thanks,
gfortran and every other fortran compiler I've seen passes by address.
At anyrate, in trying to come up with a simple example to replicate the
problem I had with passing user defined types, I found that it's a bug
in my code. In the future I have to be more dilligent before posting.
Thanks for the help.