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: 109fba,2c25d9643f05ffd1 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,2c25d9643f05ffd1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-16 20:06:32 PST Path: archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!in.100proofnews.com!in.100proofnews.com!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr13.news.prodigy.com.POSTED!8b2ffdec!not-for-mail From: red floyd User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: calling an ada procedure from C++ References: <3fb24ce4$1@baen1673807.greenlnk.net> In-Reply-To: <3fb24ce4$1@baen1673807.greenlnk.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 216.100.68.34 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr13.news.prodigy.com 1069041843 ST000 216.100.68.34 (Sun, 16 Nov 2003 23:04:03 EST) NNTP-Posting-Date: Sun, 16 Nov 2003 23:04:03 EST Organization: SBC http://yahoo.sbc.com X-UserInfo1: TSUGWWKEZRUYR\H]^JKBOW@@YJ_ZTB\MV@BT]_MIJQR@EPIB_VUKAH_[MTX\IS[K[NGYJJFNOFZR_G[BUNTAOQLFE^TEHRPI]PZZRP_BMDSFQFL_]CBHXRWCMDCUZAZN@D_AKMNLEI]MWHCSXL^]NNC__CZFGSGHYYXWPFG@SCAVA]\FT\@B\RDGENSUQS^M Date: Mon, 17 Nov 2003 04:04:03 GMT Xref: archiver1.google.com comp.lang.ada:2555 comp.lang.c++:6860 Date: 2003-11-17T04:04:03+00:00 List-Id: Anthony Moss wrote: > I have an ada simulation and a windows C++ graphics program already created. > My task is to transfer the information from the ada written simulation to > the VisualC++ graphics program. This involves transfering a large structure > of information from ada to C++. To do this i have written a very small > program to pass a simple structure from ada to C++, but I am getting run > time access errors. I will place a copy of the code onto this message, so > could you tell me what is wrong and how to fix it. > thanks > Anthony Moss > The ada code is ..... > package Output is > > type Record_T is > record > First : Integer; > Second : Integer; > end record; > > --type Record_Ptr is access Record_T; > > function Struct return Record_T; > pragma Export (C, Struct, "Struct"); > > end Output; > > package body Output is > > function Struct return Record_T is > A_Record : Record_T :=(2,4); > begin > return A_Record; > end Struct; > > end Output; > > > The C++ code is.. > > typedef struct { > int first; > int second; > } A_Struct; > > extern "C" { > A_Struct Struct(); > } > > int main() > { > A_Struct A = Struct(); > > __asm nop; > return 0; > } > > ps when iinclude adainit() and adafinal I am getting > unresolved external symbol _adafinal..... > errors > > > > Cross language Ada is always tricky. What platform are you using (both C++ and Ada compilers)?