comp.lang.ada
 help / color / mirror / Atom feed
* GNAT/Interfacing C++/Dispatching
@ 2001-11-11 18:48 Volkert
  2001-11-13 19:21 ` Stephen Leake
  0 siblings, 1 reply; 4+ messages in thread
From: Volkert @ 2001-11-11 18:48 UTC (permalink / 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



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

end of thread, other threads:[~2001-11-14  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-11 18:48 GNAT/Interfacing C++/Dispatching Volkert
2001-11-13 19:21 ` Stephen Leake
2001-11-13 22:09   ` Jerry van Dijk
2001-11-14  7:47   ` Volkert Barr

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