From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,782d14fd472db944 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Question about interfacing C and Ada95 Date: 1999/11/09 Message-ID: <8086rl$57n$1@nnrp1.deja.com>#1/1 X-Deja-AN: 546165153 References: <806ud0$lu1$1@trog.dera.gov.uk> X-Http-Proxy: 1.0 x25.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Nov 09 04:10:31 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-11-09T00:00:00+00:00 List-Id: In article , tmoran@bix.com wrote: > >we have recoded the c to this as Ada funcs do not allow more than > >one return val; > > > >void getX ( void **instance, int *float, int *error ); > > > >How do I then write the Ada to interface to this in Ada 95. > procedure getX(M : in out Matrix; > Float : in out integer; > Error : out integer); > or so, depending on just what you want. > Actually, both Ada and C allow a single return value from a > function, ie "result = getX(....);", but Ada in addition allows > "out" or "in out" parameters to procedures, which in C must be > simulated by passing "in" a pointer to the target parameter. Note incidentally, that, following the DEC ADa 83 design, GNAT provides value returning procedures that allow modeling of external functions with out parameters. See description of Import_Valued_Procedure pragma in DEC or GNAT documentation. Sent via Deja.com http://www.deja.com/ Before you buy.