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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7b93c6665052aea2,start X-Google-Attributes: gid103376,public From: Rod Chapman Subject: How to pass access parameters to/from C safely/portably? Date: 1998/06/01 Message-ID: <3572CB7D.FD6D8084@praxis-cs.co.uk>#1/1 X-Deja-AN: 358478770 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: Praxis plc, U.K. Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-06-01T00:00:00+00:00 List-Id: I wonder if anyone out there could advise me on a point of portability and style with respect to passing access parameters from C to Ada. I need to call Ada subprograms from C, passing C pointers which denote "in" or "out" parameter for Ada. Assuming I want C to pass Ada a pointer-to-int...is it better to do: procedure XXX ( Ptr : access Interfaces.C.Int ); pragma Export(C, XXX); or type Ptr_To_Int is access Interfaces.C.Int; procedure XXX ( Ptr : in Ptr_To_Int ); pragma Export(C, XXX); I read in Barnes' "Programming in Ada 95" that "In order for this check to be possible all access parameters carry with them an indication of the accessibility of the actual parameter"...this seems to imply that the first option above shouldn't work, since C obviously has no idea of how to pass accessibility information...is that right? Oddly, (using ObjectAda 7.1.1), we seem to have made the first scheme work, but this might be purely luck! Thanks in advance, Rod Chapman Praxis Critical Systems rod@praxis-cs.co.uk