From: Tim Prince <n8tm@aol.com>
To: gcc-help@gcc.gnu.org
Subject: Re: fortran 90 passing user defined type member to a c fucntion
Date: Sun, 28 Mar 2010 20:52:00 -0000 [thread overview]
Message-ID: <4BAEC71B.9090200@aol.com> (raw)
In-Reply-To: <4BAE42FF.7020200@gmail.com>
On 3/27/2010 10:40 AM, burlen wrote:
> 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.
>
If you wish to assure control over pass by value/reference, it's all
there in iso_c_binding. You appear to be trying to avoid standard
facilities on the Fortran, and you're leaving us guessing about your C side.
--
Tim Prince
prev parent reply other threads:[~2010-03-28 3:04 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
2010-03-28 7:29 ` Ian Lance Taylor
2010-03-28 20:22 ` burlen
2010-03-28 20:52 ` Tim Prince [this message]
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=4BAEC71B.9090200@aol.com \
--to=n8tm@aol.com \
--cc=gcc-help@gcc.gnu.org \
--cc=tprince@computer.org \
/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).