* Re: SGI inheriting C++ classes ...
1994-11-17 21:46 SGI inheriting C++ classes Bennett, Chip (KTR) ~U
@ 1994-11-18 2:47 ` David Weller
1994-11-18 23:09 ` Tom Quiggle
1994-11-19 7:12 ` Robert Dewar
2 siblings, 0 replies; 8+ messages in thread
From: David Weller @ 1994-11-18 2:47 UTC (permalink / raw)
In article <2ECBCF25@SMTPGATE2.STRATCOM.AF.MIL>,
Bennett, Chip (KTR) ~U <BennettC@J64.STRATCOM.AF.MIL> wrote:
>Recently, in info-ada, David Weller made a reference to "... SGI's cool
>demonstration of inheriting from C++ classes ...", that from the context, I
>assume means inherited by Ada 9X.
>
>What is that all about. Did SGI demo the ability to fully inherit C++
>classes by Ada 9X at TRI-Ada?
>
Yes! YOu must have missed that demo :-) That was The Big Brag in
the SGI booth (with words backed up by deeds, in the traditional SGI
fashion :-)
.
--
Proud (and vocal) member of Team Ada! (and Team OS/2) ||This is not your
Ada -- Very Cool. Doesn't Suck. || father's Ada
For all sorts of interesting Ada tidbits, run the command: ||________________
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
Just another dull, stodgy, non-creative developer who uses Ada.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SGI inheriting C++ classes ...
1994-11-17 21:46 SGI inheriting C++ classes Bennett, Chip (KTR) ~U
1994-11-18 2:47 ` David Weller
@ 1994-11-18 23:09 ` Tom Quiggle
1994-11-19 5:13 ` Cyrille Comar
1994-11-19 7:12 ` Robert Dewar
2 siblings, 1 reply; 8+ messages in thread
From: Tom Quiggle @ 1994-11-18 23:09 UTC (permalink / raw)
In article <2ECBCF25@SMTPGATE2.STRATCOM.AF.MIL>, "Bennett, Chip writes:
> Recently, in info-ada, David Weller made a reference to "... SGI's cool
> demonstration of inheriting from C++ classes ...", that from the context, I
> assume means inherited by Ada 9X.
Your assumption is basically correct.
> What is that all about. Did SGI demo the ability to fully inherit C++
> classes by Ada 9X at TRI-Ada?
Let me first respond to the general issue of Ada9x interfacing to C++ classes,
then describe the specifics of the demo we were showing at TriAda.
-------------------
As has been widely publicized, SGI's Ada9x product strategy is based on
a commercially supported version of the GNAT, integrated with SGI's
multilinguial software development environment. Following detailed
design discussions with SGI, the GNAT team (and specifically Cyrille
Comar) has added several implementation-defined pragmas to the GNAT to
facilitate interfacing to C++ classes from Ada.
C++ classes with virtual member functions are represented as Ada9x
tagged types. With pragma advice, the GNAT will layout the tagged type to
exactly correspond to the layout of the C++ class (including the C++ virtual
function table). The C++ member functions,virtual and non-virtual, are
imported in the usual manner with Pragma Import. For virtual member functions,
there is an additional pragma to specify which vtable pointer and index to
use in generating dispatching calls (I say which vtable pointer because in
the case of a C++ class with multiple base classes, you may have more than
one vtable pointer to dispatch off of).
The net result is that C++ classes and objects may be directly imported
into Ada9x programs. In addition to directly using a C++ class, an Ada
application can derive off of a C++ class and:
- add a record extension part (i.e. add new member data)
- add new primitive oparations (i.e. add new member functions)
- override C++ virtual functions with Ada implementations
Objects of a C++ class type (or type derived from such a type) may be declared
in Ada and operated on by either Ada subprograms or C++ member functions. Since
such objects share a common virtual-function/dispatch table, either language can
dispatch calls to operations defined in the other language. All of this has
been demonstrated with both SGI's C++ compiler and the GNU C++ compiler (G++).
To aid in building Ada interfaces to C and C++ libraries, SGI is
developing a tool capable of reading C/C++ header files and generating
corresponding Ada package specifications. The binding generator
produces the appropriate implementation defined pragmas for specifying
the layout of C++ classes, as well as the necessary mangled linknames
for C++ member functions. The tool will also drop out-of-line bodies for
in-line member functions (which have no callable body in a the compiled C++
object code), and perform other minor miracles. :-)
--------------
All of which leads me to Puck...
SGI offers OpenInventor, an object-oriented, interactive, 3D modeling and
rendering library consisting of ~200 classes in as many header files. The
inventor team produced a superb C++ example program in the form of an
interactive game resembling ice hocky.
In the week preceding TriAda (actually in just over 4 days), I
translated the main program of Puck to Ada9x, and generated slightly
more than 38000 lines of Ada bindings to (a subset) of the OpenInventor
header files needed by Puck. The result was a mixed language
application in which the highest level objects in the system were
declared in Ada, and implemented in C++. In this specific example, no
derivation (subclassing) was performed on the Ada side. As time
permits, and I rewrite more of the Puck application code in Ada, this
will change.
> Thanks,
No problem. If you have further questions, feel free to contact me
directly.
> *****************************************************************
> * Chip Bennett, GDE Systems Inc | BennettC@j64.stratcom.af.mil *
> * USSTRATCOM/J64213 | Voice (402)294-7360 *
> * 901 SAC Blvd, Suite 2B24 | FAX (402)294-7912 *
> * Offutt AFB, NE 68113-6600 | Proud member of Team Ada *
> * Opinions expressed here are my own _so_, TTFWTW *
> *****************************************************************
------
Tom Quiggle quiggle@sgi.com
Silicon Graphics (415) 390 - 2884
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: SGI inheriting C++ classes ...
1994-11-17 21:46 SGI inheriting C++ classes Bennett, Chip (KTR) ~U
1994-11-18 2:47 ` David Weller
1994-11-18 23:09 ` Tom Quiggle
@ 1994-11-19 7:12 ` Robert Dewar
1994-11-21 15:09 ` R. William Beckwith
2 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 1994-11-19 7:12 UTC (permalink / raw)
"Did SGI demonstrate ..."
GNAT supports fully interoperable dispatching and inheritance between GNAT
Ada and C++. FOr example, you can import a C++ class, then extend it on
the Ada side, using dynamic dispatching with it, and then reexport the
extended version back to C++. THe interface is procedurable allowing
customization for all C++ compilers we know about.
SGI has written an automatic binding generator that uses the GNAT features
(consisting of a set of specialized pragmas) to generate Ada bindings from
C++.
The demo at Tri-Ada involved the semi-automatic translation of some 40,000
lines of C++ headers from the inventor toolset. The actual demo was a 200
line main program, driving, via about 30,000 lines of generated CAda
bindings, an existing C++ code to implement the Puck game.
It's all in a quite preliminary stage, and this was definitely a demo, but
GI fully intends to develop this capabality.
P.S. the invenrot demo was completed in a period of 4 days.
^ permalink raw reply [flat|nested] 8+ messages in thread