From: Volkert.Barr@freenet.de (Volkert)
Subject: GNAT/Interfacing C++/Dispatching
Date: 11 Nov 2001 10:48:27 -0800
Date: 2001-11-11T18:48:27+00:00 [thread overview]
Message-ID: <b84db440.0111111048.6a10c609@posting.google.com> (raw)
Hello c.l.a.
Is this true, that dispatching works not across
languages boundaries when interfacing Ada 95 with C++
(using C++ Interface mechanisms of GNAT 3.13p.)?
Example:
C++
class A {
void f() {
g();
};
virtual void g() {
// do something
}
}
Ada:
package A_Type is
-- corresponds to C++ Class A
type A is tagged
record
...
Vptr : Interfacing.CPP.Vtable_Ptr;
end record;
pragma CPP_Class ...
pragma CPP_Vtable ...
procedure f (Self : in A'Class);
pragma Import(CPP, f, ...);
procedure g (Self: in A);
pragma CPP_Virtual (g);
pragma Import(CPP, ...)
end A_Type;
-- extends A
package B_Type is
type B is new A with ...
procedure g (Self : in B); -- redefines g of A.
...
end B_Type;
with ...
procedure Main is
Object : aliased B;
begin
-- ERROR (?)
f(Object); -- calls c++ method g,
-- not the primitive g of the tagged type B.
end;
Any hints?
With regards,
Volkert Barr
next reply other threads:[~2001-11-11 18:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-11 18:48 Volkert [this message]
2001-11-13 19:21 ` GNAT/Interfacing C++/Dispatching Stephen Leake
2001-11-13 22:09 ` Jerry van Dijk
2001-11-14 7:47 ` Volkert Barr
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox