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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2c25d9643f05ffd1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-17 16:03:42 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!louie!tlk!not-for-mail Sender: lbrenta@lbrenta Newsgroups: comp.lang.ada Subject: Re: calling an ada procedure from C++ References: <3fb24ce4$1@baen1673807.greenlnk.net> <1069079554.9445@master.nyc.kbcfp.com> From: Ludovic Brenta User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Date: 18 Nov 2003 01:03:39 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 217.136.193.234 X-Trace: 1069113820 reader3.news.skynet.be 15804 217.136.193.234:55779 X-Complaints-To: usenet-abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:2599 Date: 2003-11-18T01:03:39+01:00 List-Id: I think some compilers will also return small structures in processor registers. They will neither use the stack not any static memory, if they can help it. The basic point remains: how each compiler passes structures between efunctions is compiler-specific. It is however possible, both in C and in Ada, to specify the exact bit pattern for a stucture, and thus to pass the structure back and forth. I think the most portable way would be to pass pointers to the structures (as earlier suggested) but if the OT uses GNAT (where the compiler handles both C and Ada), there may be more efficient ways using representation clauses and Pragma Convention. BTW, C++ is a different beast altogether. I would avoid it if possible, especially if the C++ struct is really a class with methods and parents or descendants. Better stick with a strictly C struct. My 2 cents. -- Ludovic Brenta.