comp.lang.ada
 help / color / mirror / Atom feed
From: "John Haddon" <jf_haddon@QinetiQ.com>
Subject: Re: Interfacing ADA to C++ classes with parameters
Date: Thu, 4 Apr 2002 09:18:33 +0100
Date: 2002-04-04T09:18:33+01:00	[thread overview]
Message-ID: <a8h246$1l5$1@hamble.qinetiq.com> (raw)
In-Reply-To: a8f1gd$eh8$1@ns.felk.cvut.cz

Thanks,

The mangled name was test_int_param__1Ai, data can now be passes into the
routine, modified and returned OK.  The reason that I'm trying to do this is
because I need to link to existing C++ code which is class based. Does
anyone know of an automatic tool for defining the binding between ADA and
C++,  C2ADA does not cope with a lot of C++ constructs.


John



"Sergey Koshcheyev" <serko84@hotmail.com> wrote in message
news:a8f1gd$eh8$1@ns.felk.cvut.cz...
> Hi,
>
> The link name you use in pragma Import_Function below is wrong. It
> corresponds to A::test_int_param(void) - try running c++filt and typing
the
> mangled name into it.
>
> You have to figure out the correct link name and use that. Also, are you
> sure that the A'Class argument should be the last in the argument list? I
> would myself expect the "this" pointer to be the first argument, but I
don't
> know the low-level details.
>
> Sergey.
>
> "John Haddon" <jf_haddon@QinetiQ.com> wrote in message
> news:a8ete9$sa8$1@hamble.qinetiq.com...
> > Dear All,
> >
> > I'm having a problem writing an interface to a C++ class in which I want
> to
> > pass a parameter in addition to the object. I attach the package spec,
the
> > main program and the C header file. The interface compiles and links
with
> > the main program EXCEPT for TEST_INT_RET. On linkage, the following
error
> is
> > given:
> >
> > ./ex6d_main.o: In function `ex6d_main__dispatch':
> > C:/PROGRA~1/GNAT/Examples_jfh/ex6d_main.adb:25: undefined reference to
> > `A::test_int_param(void)'
> >
> > Why is this trying to refer to A::test_int_param(void) and not
> > A::test_int_param(integer,void)?
>
> > <snip>
> > -- IS THE FOLLOWING LINE CORRECT?
> >       pragma import_function(test_int_param,"
> > test_int_param__1A",(integer,A'Class),(integer));
> > <snip>
>
>
>





  reply	other threads:[~2002-04-04  8:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03 12:46 Interfacing ADA to C++ classes with parameters John Haddon
2002-04-03 13:53 ` Sergey Koshcheyev
2002-04-04  8:18   ` John Haddon [this message]
2002-04-05 15:44     ` Robert Dewar
2002-04-05 19:15       ` Ted Dennison
2002-04-03 14:28 ` Mário Amado Alves
2002-04-03 19:01 ` Stephen Leake
replies disabled

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