comp.lang.ada
 help / color / mirror / Atom feed
* GNAT/C++ & Multiple constructors
@ 2004-02-27  2:05 Luke A. Guest
       [not found] ` <m2d67yjcml.fsf@jvdsys.demon.nl>
  0 siblings, 1 reply; 2+ messages in thread
From: Luke A. Guest @ 2004-02-27  2:05 UTC (permalink / raw)


Hi,

I'm new to OO in Ada, but I've built a simple example which has a C++
class imported into GNAT successfully. Is there any way to get multiple
constructors working?

Why does Ada require a vtable when importing C++ classes which have no
virtuals?

Thanks,
Luke.




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

* Re: GNAT/C++ & Multiple constructors
       [not found] ` <m2d67yjcml.fsf@jvdsys.demon.nl>
@ 2004-02-29 17:09   ` Luke A. Guest
  0 siblings, 0 replies; 2+ messages in thread
From: Luke A. Guest @ 2004-02-29 17:09 UTC (permalink / raw)


On Sun, 29 Feb 2004 13:25:54 +0100, Jerry van Dijk wrote:

> 
> "Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> writes:
> 
>> I'm new to OO in Ada, but I've built a simple example which has a C++
>> class imported into GNAT successfully. Is there any way to get multiple
>> constructors working?
> 
> It's been a while since I used it, but I would thing that simply
> declaring multiple CPP_Constructor pragma's would work. Doesn't it ?

Nope, not under GNAT.

>> Why does Ada require a vtable when importing C++ classes which have no
>> virtuals?
> 
> Note that Ada does not require anything as it does not interface with C++. 
> GNAT has an extension for it. 

Yeah, I know.
 
> As for the vtable, the GNAT documentation says:
> 
>      If (and only if) the type is tagged, at least one component in the
>      record must be of type `Interfaces.CPP.Vtable_Ptr', corresponding
>      to the C++ Vtable (or Vtables in the case of multiple inheritance)
>      used for dispatching.
> 
> With other words, if the type is not tagged, you do not need a vtable.

Yeah, I just couldn't get it to work.

Anyway, I decided to try to C-ify the interface and import C functions ;-)
Much more portable.

Luke.




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

end of thread, other threads:[~2004-02-29 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27  2:05 GNAT/C++ & Multiple constructors Luke A. Guest
     [not found] ` <m2d67yjcml.fsf@jvdsys.demon.nl>
2004-02-29 17:09   ` Luke A. Guest

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