comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Can ADA95 inherit from C++ classes
Date: 1997/09/19
Date: 1997-09-19T00:00:00+00:00	[thread overview]
Message-ID: <dewar.874680076@merv> (raw)
In-Reply-To: 34212D90.318E@gsfc.nasa.gov


Stephen said

<<In another response I said ObjectAda could do this. That's wrong;
ObjectAda can _import_ C++ classes as packages, but it cannot _inherit_
from C++ classes. Sorry for the misunderstanding.>>

Just to make sure that things are clear, GNAT *can* import C++ classes,
including multiply inherited classes from C++, treat them as tagged
types, extend them with new primitive operations, and pass the resulting
tagged type back to C++ to be treated as an extended class.

However, this is a complex mechanism, and has to be tailored to a particular
C++ compiler, since it obviously depends on Ada and C++ using identical
data structures for the objects. This tailoring is done by modifying the
body, and possibly the private part of the package Interfaces.CPP.

Furthermore, to use the interfacing capability, a rather complex set of
pragmas is required. These pragmas can be generated by hand, but it is a
tricky process. SGI has a binding generator that automatically generates
these pragmas for their Delta C++ technology compiler used together with
GNAT.

People have experimented successfully with example bindings to C++ in
other environments (e.g. Microsoft C++), but for this feature to be
fully usable, a binding generator is most desirable. 

Such a binding generator is not a trivial tool, since it needs full
understanding of the C++ sources, and must therefore be built around
a C++ front end. Ada Core Technologies hopes to introduce a binding
generator capable of handling this problem some time in the future, but
there is no definite schedule for this work.

Meanwhile, it is most certainly possible to import C++ classes as packages,
if necessary by using a C wrapper to ensure maximum portability.





  reply	other threads:[~1997-09-19  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-16  0:00 Can ADA95 inherit from C++ classes Daniel E Griffin
1997-09-16  0:00 ` Stephen Leake
1997-09-17  0:00 ` Robert Dewar
1997-09-18  0:00 ` Stephen Leake
1997-09-19  0:00   ` Robert Dewar [this message]
1997-09-22  0:00     ` John G. Volan
replies disabled

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