From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a3eb57f922d7562d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-13 23:47:57 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-fra1.dfn.de!news-ber1.dfn.de!news.uni-hamburg.de!cs.tu-berlin.de!not-for-mail From: Volkert Barr Newsgroups: comp.lang.ada Subject: Re: GNAT/Interfacing C++/Dispatching Date: Wed, 14 Nov 2001 08:47:56 +0100 Organization: TU Berlin, Fachbereich Informatik Message-ID: <3BF221AC.C6E2EC54@cs.tu-berlin.de> References: NNTP-Posting-Host: bolero.cs.tu-berlin.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.cs.tu-berlin.de 1005724076 18925 130.149.19.1 (14 Nov 2001 07:47:56 GMT) X-Complaints-To: news@cs.tu-berlin.de NNTP-Posting-Date: 14 Nov 2001 07:47:56 GMT X-Mailer: Mozilla 4.78 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:16488 Date: 2001-11-14T07:47:56+00:00 List-Id: Stephen Leake wrote: > > Volkert.Barr@freenet.de (Volkert) writes: > > > 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.)? > > I have not done it, and I did not read your code in detail, but > GNAT/g++ is supposed to allow full inter-operation between Ada tagged > types and C++ classes. So keep trying! Yes! Simple interfacing to C++ Classes seems to work well. But when is comes to polymophism i run into trouble. Polymophism on Ada side works. But, dispatching calls starting at the c++ side do not propagate into the Ada work. I think, a C++ class does not know the dispatching table, which i have to add to an Ada tagged type. The c++ work does not know about overriden features from the Ada side. Expample: class A { void f() { this->g(); }; virtual void g() { // do something } } 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; If i override g() on the Ada side (with a new tagged type B_Type) and i call f() on an object of Type T_type in the Ada world, i would expect the call of the overridden g() method (primitive operation of tagged type B_Type) BTW: For all C++ virtual declared mothods i follow the gnat convention to add a prama CPP_Virtual. With regards, Volkert > > > > -- > -- Stephe -- - - - - - - - - - - - - - - - - - - - - - - - - - - - Volkert Barr Institut fuer Softwaretechnik und Theoretische Informatik Fachgruppe Softwaretechnik * TU Berlin email: barr@cs.tu-berlin.de web: www.cs.tu-berlin.de/~barr - - - - - - - - - - - - - - - - - - - - - - - - - - - * macrosolutions to megaproblems *