From: gisle@spurv.ii.uib.no (Gisle S�lensminde)
Subject: Re: ada to c interfaces and CHARS_PTR
Date: 2000/03/09
Date: 2000-03-09T00:00:00+00:00 [thread overview]
Message-ID: <slrn8cg0rv.mlp.gisle@spurv.ii.uib.no> (raw)
In-Reply-To: 38C7E515.29C42580@mindspring.com
In article <38C7E515.29C42580@mindspring.com>, Al Johnston wrote:
>I have been trying (for longer than I care to admit) to use the
>following c subroutine from
>ada:
C has not 'in out' parameters, only 'in' parameters. To pass the
pointer to the string you can use system'address. str'address is
equivalent to &str in C. The following Ada code can replace
the Ada code of your last posting:
with text_io;
with interfaces.c.strings;
with System;
use interfaces.c.strings;
package body a_sub is
procedure a_sub is
procedure c_sub(in_strg_fml : CHARS_PTR;
inout_strg_fml : System.address);
pragma import(c,c_sub,"sub");
in_strg_act : CHARS_PTR;
inout_strg_act : CHARS_PTR := Null_Ptr;
begin
text_io.put_line(" in a_sub");
in_strg_act := NEW_STRING("I am here");
c_sub(in_strg_act, Inout_Strg_Act'address);
text_io.put_line("----------");
text_io.put_line("He said ==>> "
& VALUE(inout_strg_act) &
" <<==");
text_io.put_line(" out a_sub");
end a_sub;
end a_sub;
--
Gisle S�lensminde ( gisle@ii.uib.no )
ln -s /dev/null ~/.netscape/cookies
next prev parent 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 [this message]
2000-03-09 0:00 ` Al Johnston
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 ` tmoran
2000-03-15 0:00 ` Al Johnston
2000-03-15 0:00 ` Robert Dewar
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