From: "Eric G. Miller" <egm2@jps-nospam.net>
Subject: Re: Interfacing to C library...
Date: Sat, 02 Nov 2002 18:35:16 GMT
Date: 2002-11-02T18:35:16+00:00 [thread overview]
Message-ID: <pan.2002.11.02.18.38.36.851267@jps-nospam.net> (raw)
In-Reply-To: wcck7jwuf3v.fsf@shell01.TheWorld.com
In <wcck7jwuf3v.fsf@shell01.TheWorld.com>, Robert A Duff wrote:
> "Eric G. Miller" <egm2@jps-nospam.net> writes:
>
>> Seems Ada always passes records via C pointers. So, the above
>> doesn't work. Surely, there's a way! Or do I need a C wrapper for
>> my Ada wrapper ;-(
>
> This is a bug in the Ada 95 language, which, I must admit, is partly my
> fault. It has since been "fixed" by adding pragma C_Pass_By_Copy.
> See AI-131. This AI is approved by WG9, and is part of Corrigendum 1.
>
> Perhaps "fixed" is an overstatement. The bug has been patched with a
> kludgy pragma.
Missed that addition since I was looking at a copy of original RM...
Anyway, I don't think the C_Pass_By_Copy semantics quite work the way I
want them too (or, it's "kludgy"). All the "Set" routines of this C
library take C structs by copy while all the "Get" routines take pointers
and all routines return (in the function sense) a long integer status
code. I've found if I use access types for the "Get" routines, then I
have to worry about aliasing and need to use T'Unchecked_Access or I
need to dynamically create the objects via "new". I think I like the
GNAT Import_Function()/Import_Procedure() pragmas a little better,
since they facilitate finer control over the parameter passing method.
However, I'd rather not use compiler specific capabilities...
next prev parent reply other threads:[~2002-11-02 18:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-01 15:38 Interfacing to C library Eric G. Miller
2002-11-01 17:11 ` Robert A Duff
2002-11-01 17:40 ` tmoran
2002-11-02 5:10 ` Eric G. Miller
2002-11-02 6:02 ` tmoran
2002-11-02 16:10 ` Robert A Duff
2002-11-02 18:35 ` Eric G. Miller [this message]
2002-11-02 18:55 ` Robert A Duff
2002-11-02 23:59 ` Eric G. Miller
2002-11-03 16:47 ` Robert A Duff
2002-11-03 18:55 ` Eric G. Miller
2002-11-03 9:28 ` Dale Stanbrough
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox