comp.lang.ada
 help / color / mirror / Atom feed
* Can ADA95 inherit from C++ classes
@ 1997-09-16  0:00 Daniel E Griffin
  1997-09-16  0:00 ` Stephen Leake
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel E Griffin @ 1997-09-16  0:00 UTC (permalink / raw)



I have heard that on the project I'm on they are planning on inheriting
from C++ classes in their Ada 95 code.  Is this possible and if so how?

Thanks in advance,
Dan.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can ADA95 inherit from C++ classes
  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
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Leake @ 1997-09-16  0:00 UTC (permalink / raw)



Daniel E Griffin wrote:
> 
> I have heard that on the project I'm on they are planning on inheriting
> from C++ classes in their Ada 95 code.  Is this possible and if so how?
> 
> Thanks in advance,
> Dan.

This is compiler dependent; GNAT and ObjectAda support it. You'll have
to consult the documentation for details; look for pragma Import.
ObjectAda for Windows NT/95 (at one of their price points) comes with a
binding to Microsoft's Foundation Classes.

-- 
- Stephe




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can ADA95 inherit from C++ classes
  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
  2 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1997-09-17  0:00 UTC (permalink / raw)



Dan asks

<<I have heard that on the project I'm on they are planning on inheriting
from C++ classes in their Ada 95 code.  Is this possible and if so how?>>

GNAT contains features that allow this kind of operation. These features
are fully implemented on the SGI environment, and are used to interface
to the SGI graphics libraries.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can ADA95 inherit from C++ classes
  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
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Leake @ 1997-09-18  0:00 UTC (permalink / raw)



Daniel E Griffin wrote:
> 
> I have heard that on the project I'm on they are planning on inheriting
> from C++ classes in their Ada 95 code.  Is this possible and if so how?
> 
> Thanks in advance,
> Dan.

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.

-- 
- Stephe




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can ADA95 inherit from C++ classes
  1997-09-18  0:00 ` Stephen Leake
@ 1997-09-19  0:00   ` Robert Dewar
  1997-09-22  0:00     ` John G. Volan
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dewar @ 1997-09-19  0:00 UTC (permalink / raw)



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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can ADA95 inherit from C++ classes
  1997-09-19  0:00   ` Robert Dewar
@ 1997-09-22  0:00     ` John G. Volan
  0 siblings, 0 replies; 6+ messages in thread
From: John G. Volan @ 1997-09-22  0:00 UTC (permalink / raw)



Robert Dewar wrote:
> 
> People have experimented successfully with example bindings to C++ in
> other environments (e.g. Microsoft C++)...

If anyone has successfully ported GNAT's Interfaces.CPP to Microsoft
Visual C++, I would very much like to know!  Something that can provide
a real binding to the Microsoft Foundation Classes without sacrificing
the OO-ness of either C++ or Ada95 is extremely desirable!

-- 
------------------------------------------------------------------------
Internet.Usenet.Put_Signature 
  (Name       => "John G. Volan",
   Employer   => "Raytheon/TI Advanced C3I Systems, San Jose, CA",
   Work_Email => "jvolan@ti.com",
   Home_Email => "johnvolan@sprintmail.com",
   Slogan     => "Ada95: World's *FIRST* International-Standard OOPL",
   Disclaimer => "My employer never defined these opinions, so using " & 
                 "them would be totally erroneous...or is that just "  &
                 "nondeterministic behavior now? :-) ");
------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-09-22  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
1997-09-22  0:00     ` John G. Volan

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