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/08 Message-ID: <8076h5$d3c$1@nnrp1.deja.com>#1/1 X-Deja-AN: 545986019 References: <806ud0$lu1$1@trog.dera.gov.uk> X-Http-Proxy: 1.0 x33.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Nov 08 18:58:47 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-08T00:00:00+00:00 List-Id: In article <806ud0$lu1$1@trog.dera.gov.uk>, "Hovers" wrote: > if I have a c routine that returns more than one value what is thge best way > to interface to Ada with it. > > e.g. int getX ( void **instance, int *float ); > > we have recoded the c to this as Ada funcs do not allow more > than one return Both Ada and C allow exactly one value to be returned. Both Ada and C allow pointers to be passed by value, allowing the called subprogram (function or procedure in Ada) to modify the calling parameter. Ada in addition for procedures only, has a feature (out parameters) that is not allowed in C at all. But it does not seem there is any significant problem here! Yes, it would be nice if you could model pointer parameters in C with out parameters in functions in Ada, but you can't and you certainly don't need to. Just call the function as you would in C, passing a pointer if the parameter is of a pointer type. If necessary (but please ONLY if necessary) use aliased and 'Access to pass a pointer to a declared variable. Sent via Deja.com http://www.deja.com/ Before you buy.