public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: burlen <burlen.loring@gmail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: fortran 90 passing user defined type member to a c fucntion
Date: Sun, 28 Mar 2010 03:12:00 -0000	[thread overview]
Message-ID: <4BAE42FF.7020200@gmail.com> (raw)
In-Reply-To: <mcrwrwyr70n.fsf@dhcp-172-17-9-151.mtv.corp.google.com>

Ian Lance Taylor wrote:
> burlen <burlen.loring@gmail.com> writes:
>
>   
>> When calling a c function from a fortran 90 program with members of a
>> user defined types for output arguments of the called subroutine the
>> user defined types aren't being modified as they should be (according
>> to my understanding).
>>     
>
> When you call a C function, you get the C rules.  It doesn't matter
> whether you are calling it from Fortran or not.  In C, a modification
> of an argument is not reflected back to the caller.
>
> Ian
>   
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.

  reply	other threads:[~2010-03-27 17:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 22:02 burlen
2010-03-27  6:28 ` Ian Lance Taylor
2010-03-28  3:12   ` burlen [this message]
2010-03-28  7:29     ` Ian Lance Taylor
2010-03-28 20:22       ` burlen
2010-03-28 20:52     ` Tim Prince

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BAE42FF.7020200@gmail.com \
    --to=burlen.loring@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).