public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ and Ada.
@ 2004-10-02 14:31 Daniel Lundqvist
  2004-10-02 18:34 ` Laurent GUERBY
  2004-10-02 20:50 ` Robert Dewar
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Lundqvist @ 2004-10-02 14:31 UTC (permalink / raw)
  To: gcc

Hi,

I've been toying around with Ada lately. Trying to add Ada bindings to a 
C++ library. Almost everything works perfect except one thing.
I can't seem to import classes without virtual tables.

Pragma CPP_Constructor seem to require tagged types. And if I mark the 
type tagged Pragma CPP_Class needs it to have a Vtable_Ptr field. But 
then gnats idea of how class looks like isn't correct.

Is there a way around this?

I'm still quite new to Ada so I've probably missed something.

If this is not the right forum for this I would appreciate pointers in
the right direction.

Thanks in advance,
Daniel.

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

* Re: C++ and Ada.
  2004-10-02 14:31 C++ and Ada Daniel Lundqvist
@ 2004-10-02 18:34 ` Laurent GUERBY
  2004-10-02 20:50 ` Robert Dewar
  1 sibling, 0 replies; 8+ messages in thread
From: Laurent GUERBY @ 2004-10-02 18:34 UTC (permalink / raw)
  To: Daniel Lundqvist; +Cc: gcc

I'm not an expert on C++/Ada interfacing, but did you try
importing with the C convention? Otherwise my best
advice would be to submit a testcase and detailed
explanations on http://gcc.gnu.org/bugzilla/

Laurent

On Sat, 2004-10-02 at 14:09, Daniel Lundqvist wrote:
> Hi,
> 
> I've been toying around with Ada lately. Trying to add Ada bindings to a 
> C++ library. Almost everything works perfect except one thing.
> I can't seem to import classes without virtual tables.
> 
> Pragma CPP_Constructor seem to require tagged types. And if I mark the 
> type tagged Pragma CPP_Class needs it to have a Vtable_Ptr field. But 
> then gnats idea of how class looks like isn't correct.
> 
> Is there a way around this?
> 
> I'm still quite new to Ada so I've probably missed something.
> 
> If this is not the right forum for this I would appreciate pointers in
> the right direction.
> 
> Thanks in advance,
> Daniel.
> 
> 

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

* Re: C++ and Ada.
  2004-10-02 14:31 C++ and Ada Daniel Lundqvist
  2004-10-02 18:34 ` Laurent GUERBY
@ 2004-10-02 20:50 ` Robert Dewar
  2004-10-03  6:48   ` Daniel Lundqvist
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Dewar @ 2004-10-02 20:50 UTC (permalink / raw)
  To: Daniel Lundqvist; +Cc: gcc

Daniel Lundqvist wrote:
> Hi,
> 
> I've been toying around with Ada lately. Trying to add Ada bindings to a 
> C++ library. Almost everything works perfect except one thing.
> I can't seem to import classes without virtual tables.
> 
> Pragma CPP_Constructor seem to require tagged types. And if I mark the 
> type tagged Pragma CPP_Class needs it to have a Vtable_Ptr field. But 
> then gnats idea of how class looks like isn't correct.

Right, with the current implementation, you can't import a class without
a virtual table as a tagged type (you could of course import it as a
normal Ada record).

As it turns out, we are starting to take another look at the whole
CPP pragma support, with an eye also on the new Interfaces feature
of Ada 95. We are preparing an initial discussion document on an
implementation approach for Interfaces, which we will post on this
list for discussion when it is ready. Our initial thought is to try
to make the implementation of Interfaces as compatible as possible
with the g++ MI model.

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

* Re: C++ and Ada.
  2004-10-02 20:50 ` Robert Dewar
@ 2004-10-03  6:48   ` Daniel Lundqvist
  2004-10-03  6:51     ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Lundqvist @ 2004-10-03  6:48 UTC (permalink / raw)
  To: Robert Dewar; +Cc: gcc

Robert Dewar wrote:
> Daniel Lundqvist wrote:
> 
>> Hi,
>>
>> I've been toying around with Ada lately. Trying to add Ada bindings to 
>> a C++ library. Almost everything works perfect except one thing.
>> I can't seem to import classes without virtual tables.
>>
>> Pragma CPP_Constructor seem to require tagged types. And if I mark the 
>> type tagged Pragma CPP_Class needs it to have a Vtable_Ptr field. But 
>> then gnats idea of how class looks like isn't correct.
> 
> Right, with the current implementation, you can't import a class without
> a virtual table as a tagged type (you could of course import it as a
> normal Ada record).

If I import it as a normal ADA record I can't use constructors,right?

And there is no way of using CPP_Constructor with a non tagged type?

> As it turns out, we are starting to take another look at the whole
> CPP pragma support, with an eye also on the new Interfaces feature
> of Ada 95. We are preparing an initial discussion document on an
> implementation approach for Interfaces, which we will post on this
> list for discussion when it is ready. Our initial thought is to try
> to make the implementation of Interfaces as compatible as possible
> with the g++ MI model.

Any timeline on this?

With this new pragma support will there be any work to eliminate the 
need for manually specifying C++ mangled symbol names? If that is possible.

Is this document available anywhere? Would be interesting to read of 
what will come.

Thanks in advance,
Daniel.

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

* Re: C++ and Ada.
  2004-10-03  6:48   ` Daniel Lundqvist
@ 2004-10-03  6:51     ` Robert Dewar
  2004-11-26 17:16       ` Luke A. Guest
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 2004-10-03  6:51 UTC (permalink / raw)
  To: Daniel Lundqvist; +Cc: gcc

Daniel Lundqvist wrote:

> If I import it as a normal ADA record I can't use constructors,right?

Right. By the way ADA is the American Dental Assocation (or
any one of several other acronyms, including Americans with Disabilities
Act -- there is a fun poster of Clinton saying "The president wants your
help with ADA". The language is called Ada, after Lord Byron's daughter,
Ada, who is given credit for being the first programmer.

> And there is no way of using CPP_Constructor with a non tagged type?

No there is not

> Any timeline on this?

not yet

> With this new pragma support will there be any work to eliminate the 
> need for manually specifying C++ mangled symbol names? If that is possible.

We don't have any plans, these pragmas are intended to be used with
a binding generator, no free software binding generator is available
yet.
> 
> Is this document available anywhere? Would be interesting to read of 
> what will come.

We will post it here when it is available :-)

> Thanks in advance,
> Daniel.

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

* Re: C++ and Ada.
  2004-10-03  6:51     ` Robert Dewar
@ 2004-11-26 17:16       ` Luke A. Guest
  2004-11-26 17:24         ` Robert Dewar
  2004-11-26 19:10         ` Robert Dewar
  0 siblings, 2 replies; 8+ messages in thread
From: Luke A. Guest @ 2004-11-26 17:16 UTC (permalink / raw)
  To: Robert Dewar; +Cc: Daniel Lundqvist, GCC ML

On Sat, 2004-10-02 at 15:30, Robert Dewar wrote:

> > With this new pragma support will there be any work to eliminate the 
> > need for manually specifying C++ mangled symbol names? If that is possible.
> 
> We don't have any plans, these pragmas are intended to be used with
> a binding generator, no free software binding generator is available
> yet.

It would be better if we could specify the compiler (and version) within
the pragma. This way we could specify what the member function name is
and have the Ada compiler generate the correctly mangled names for that
particular C++ compiler.

Sometimes, you have to generate bindings by hand :-(

Luke.


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

* Re: C++ and Ada.
  2004-11-26 17:16       ` Luke A. Guest
@ 2004-11-26 17:24         ` Robert Dewar
  2004-11-26 19:10         ` Robert Dewar
  1 sibling, 0 replies; 8+ messages in thread
From: Robert Dewar @ 2004-11-26 17:24 UTC (permalink / raw)
  To: Luke A. Guest; +Cc: Daniel Lundqvist, GCC ML

Luke A. Guest wrote:

> Sometimes, you have to generate bindings by hand :-(
> 
> Luke.
> 
As I say, there are no plans to do this currently, since we are interested
in the long run only in automatically generated bindings

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

* Re: C++ and Ada.
  2004-11-26 17:16       ` Luke A. Guest
  2004-11-26 17:24         ` Robert Dewar
@ 2004-11-26 19:10         ` Robert Dewar
  1 sibling, 0 replies; 8+ messages in thread
From: Robert Dewar @ 2004-11-26 19:10 UTC (permalink / raw)
  To: Luke A. Guest; +Cc: Daniel Lundqvist, GCC ML

Luke A. Guest wrote:

> It would be better if we could specify the compiler (and version) within
> the pragma. This way we could specify what the member function name is
> and have the Ada compiler generate the correctly mangled names for that
> particular C++ compiler.

Also, the pragma does not have the C++ prototype, only the
corresponding Ada one, which is not enough information to
generate the correct mangling in all cases. Mangling is
definitely something that has to be done with an external
tool.

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

end of thread, other threads:[~2004-11-26 17:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-02 14:31 C++ and Ada Daniel Lundqvist
2004-10-02 18:34 ` Laurent GUERBY
2004-10-02 20:50 ` Robert Dewar
2004-10-03  6:48   ` Daniel Lundqvist
2004-10-03  6:51     ` Robert Dewar
2004-11-26 17:16       ` Luke A. Guest
2004-11-26 17:24         ` Robert Dewar
2004-11-26 19:10         ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).