comp.lang.ada
 help / color / mirror / Atom feed
From: Al Johnston <sofeise@mindspring.com>
Subject: Re: ada to c interfaces and CHARS_PTR
Date: 2000/03/09
Date: 2000-03-09T21:11:41+00:00	[thread overview]
Message-ID: <38C81310.41EB934A@mindspring.com> (raw)
In-Reply-To: slrn8cg0rv.mlp.gisle@spurv.ii.uib.no

> C has not 'in out' parameters, only 'in' parameters. To pass the

???? Although I am still trying to figure this stuff out, it seems to
me that c as as much of an in/out as any other language has.  To
effect a "in out" or "out" at the lowest level you are always passing
the address of a thing to write to.  C just lets you have that method
only, where other languages "hide" this from you by there abstract
"in out" methods.  When It comes down to it a language's means for
implementing a inout/out argument is to pass it by reference.  this is
what you do when you say "char **foo" in c.  The only exception
I have found to this rule is ada, where a inout/out may actually,
according to the RM/Rat be passed by value and then copied
back.  But the RM explicitly says that passing by value is NOT
allowed if the convention "c" applies.  Since this routine is
a pragma import(c,...) then the out/inout are done by reference,
and therefore should be adding the second level of indirection that
is being used by ada....   But then again, I could by totally
wrong about this... but it is my current understanding...

IN ANY case, I ask for a way using CHARS_PTR;  your
solution uses system.address...  I have this stuff working
in various places using system.address.  The reason I
ask about CHARS_PTR is that I thought the whole
point of the Anx B stuff was so that you did not have
to use such dangerous things as system.address anymore.

Maybe this is where I am wrong... The Rat seems to
be saying you can do this, but it doesn't give an example,
and gnat doesn't seem to do this in its code either...

still looking for help/guidance

-al





  reply	other threads:[~2000-03-09  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-09  0:00 ada to c interfaces and CHARS_PTR Al Johnston
2000-03-09  0:00 ` Preben Randhol
2000-03-09  0:00   ` Al Johnston
2000-03-09  0:00 ` Gisle S�lensminde
2000-03-09  0:00   ` Al Johnston [this message]
2000-03-13  0:00     ` Robert Dewar
2000-03-15  0:00       ` Al Johnston
2000-03-11  0:00   ` Simon Wright
2000-03-14  0:00     ` Al Johnston
2000-03-15  0:00       ` Robert Dewar
2000-03-15  0:00       ` tmoran
2000-03-15  0:00         ` Al Johnston
2000-03-10  0:00 ` Al Johnston
2000-03-10  0:00 ` tmoran
2000-03-10  0:00   ` Al Johnston
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox