comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Calling Ada from C++ (MS Visual C++)
Date: 11 Apr 2002 13:15:33 -0400
Date: 2002-04-11T17:21:27+00:00	[thread overview]
Message-ID: <uadsap362.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3ab585c8.0204110051.3659218c@posting.google.com

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



  reply	other threads:[~2002-04-11 17:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-05  8:30 Calling Ada from C++ (MS Visual C++) Julian Robbins
2002-04-05 18:18 ` Stephen Leake
2002-04-11  8:51   ` Julian Robbins
2002-04-11 17:15     ` Stephen Leake [this message]
2002-04-16 12:27       ` Karel Miklav
2002-04-16 14:07         ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2002-04-05 10:26 Caldwell Ian
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox