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,9b1d37f5a56928f1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-11 10:34:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Calling Ada from C++ (MS Visual C++) Date: 11 Apr 2002 13:15:33 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3ab585c8.0204050030.3d94e692@posting.google.com> <3ab585c8.0204110051.3659218c@posting.google.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1018545687 10751 128.183.220.71 (11 Apr 2002 17:21:27 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 11 Apr 2002 17:21:27 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:22374 Date: 2002-04-11T17:21:27+00:00 List-Id: julian_robbins@bigfoot.com (Julian Robbins) writes: > Okay, so here is what I have done... > > Compiled the original "mathutil.adb" into "mathutil.o". Then used > "gnatbind -n mathutil" which produced the files "b~mathutil.adb" and > ".ads". I then compiled these using gcc and renamed the resulting .o > file "main.o". I wouldn't call it "main", since it is _not_ your C "main". Call it "ada_elab_stuff". Or at least "ada_main". Actually, there's nothing wrong with "b~mathutil" :). > Within my VC++ project I have then included the mathutil.o and > main.o files, added calls to adainit() and adafinal() and then > compiled/linked. This throws up various missing links, so I have > included the following library files: libgnat.a libgcc.a > libmingw32.a > > Does this seem correct?? Yes, you've got it. > It seems to compile and run, but I can't help thinking that this > process seems a bit odd. Welcome to the world of multi-language multi-vendor programming :). You've got it easier than I did; I was using Borland C++, which has a different object file format than GNAT on Win32. So I had GNAT build a DLL to link with Borland. Reverse engineering the naming conventions took a while! Just out of curiosity, why are you using MS C++ instead of Gnu C++? I'll assume it's to get MFC. -- -- Stephe