comp.lang.ada
 help / color / mirror / Atom feed
From: James Huckaby <jhuckaby@mps.lmtas.lmco.com>
To: "Stanley R. Allen" <s_allen@hso.link.com>
Subject: Re: C++ to Ada Link Problems
Date: 1998/02/27
Date: 1998-02-27T00:00:00+00:00	[thread overview]
Message-ID: <34F7266D.203BF762@mps.lmtas.lmco.com> (raw)
In-Reply-To: 34F71D58.2781@hso.link.com


Stanley R. Allen wrote:
> But by the wording of your question, I suppose that you
> have alreasy worked out those issues and are trying now
> to build an executable.  The main issue is C++ constructor/
> deconstructor ("Xtor") operations for statically-declared
> object instances: how do they get called?  In Ada, global
> variable initialization is defined in the language as
> part of the elaboration process.  In C++, it is the
> job of external tools.  A common way of creating the
> contructor/destructor caller is to "munch" the object
> code produced by the C++ compiler (using a munching
> tool), which will produce a C file that calls the
> Xtors.  Compiling this C file and linking the new
> object module with the C++ code will ensure that the
> C++ static objects are constructed properly.  To link
> with Ada, ensure that the object file created from
> the C program is included as one of the inputs to the
> linker building the Ada main.  (Since you are talking
> about Ada 83, I assume that the main program is in Ada.)
> My understanding is that munching is the approach
> used by the GNU C++ implementation.
> 
> Other C++ compilers don't require a separate munching
> phase, but expect that the linker will include calls
> to the proper contructor/destructors.  If the Ada
> binding program (I think that would be a.ld for SunAda)
> is used to create the Unix "ld" command, then the
> stuff C++ needs will not be included.  I'm not sure how
> it works on the Sun; on the SGI with Delta C++ you can
> specify that the C++ compiler itself ("CC") be used as
> the linker.  This will include the necessary code to
> call the Xtor operations for static C++ objects.

I think I might be able to redirect the a.ld command to
use CC instead of ld (it will probably be trial and error
for awhile).  Do you have any examples of munchers
or munching tools?  I did a Yahoo! search and it was
very fascinated about the wrong sort of munching and
the painter Muench. (ue = u umlaut)

''``''``''``''``''``''``''``''``''``''``''``''``''``''``''``''
James Huckaby                  mailto:James.B.Huckaby@LMCo.com
''``''``''``''``''``''``''``''``''``''``''``''``''``''``''``''
``''``''``''``''``''``''``''``''``''``''``''``''``''``''``''``




  reply	other threads:[~1998-02-27  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9802271359.AA07254@nile.gnat.com>
1998-02-27  0:00 ` C++ to Ada Link Problems James Huckaby
1998-02-27  0:00   ` Larry Kilgallen
1998-02-27  0:00     ` Robert Dewar
1998-02-28  0:00       ` Larry Kilgallen
1998-02-27  0:00   ` Stanley R. Allen
1998-02-27  0:00     ` James Huckaby [this message]
1998-02-27  0:00       ` Stanley R. Allen
1998-02-28  0:00       ` Simon Wright
1998-02-27  0:00   ` Robert Dewar
1998-02-25  0:00 James Huckaby
     [not found] ` <9802270246.AA28724@MERV.CS.NYU.EDU>
1998-02-27  0:00   ` James Huckaby
replies disabled

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