comp.lang.ada
 help / color / mirror / Atom feed
From: "Kevin F. Quinn" <kevq@banana.demon.co.uk>
Subject: Re: Interface between ADA and C++
Date: 1996/05/23
Date: 1996-05-23T00:00:00+00:00	[thread overview]
Message-ID: <31A46A6E.4B2F@banana.demon.co.uk> (raw)
In-Reply-To: 31A2C469.41C6@essiris2.atlas.de


Norbert Roeben wrote:

> I try to call an C++ function from Ada. The linker always searches for
> C - function, not for a C++ - function.

Your problem is that the C++ function name is mangled by the C++ compiler,
almost certainly.

> Does anybody has a solution for this ?

Try adding something along the lines of (un-tried)

extern "C" {
  void GlueCppHello ( char *String ) {
     CppHello(String);
  }
}

to your C++ source set - the 'extern "C" {}' construct ensures that the code
in between is treated as normal "C" code, and as such the function name
GlueCppHello isn't mangled.  Then call GlueCppHello from your Ada code.

>         Unresolved:
>         CppHello

BTW - the above is a direct result of the change in function name by the C++
compiler.  There are a number of good reasons for this, but this is not the
place to go into them.  If you have complete documentation on the C++ compiler,
it may well tell you how to determine the actual linker symbol generated, in
which case you can use this directly instead of using the 'extern "C" ' stuff.

Cheers,
Kev.




  reply	other threads:[~1996-05-23  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-22  0:00 Interface between ADA and C++ Norbert Roeben
1996-05-23  0:00 ` Kevin F. Quinn [this message]
1996-05-23  0:00   ` Mike Young
1996-05-24  0:00     ` Darren C Davenport
1996-05-29  0:00       ` Ken Slater
1996-05-29  0:00         ` Ding-yuan Sheu
1996-05-24  0:00 ` Vincent P. Amiot
replies disabled

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