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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8fec429719a29bf9 X-Google-Attributes: gid103376,public From: "Kevin F. Quinn" Subject: Re: Interface between ADA and C++ Date: 1996/05/23 Message-ID: <31A46A6E.4B2F@banana.demon.co.uk>#1/1 X-Deja-AN: 156313558 x-nntp-posting-host: cdc.demon.co.uk references: <31A2C469.41C6@essiris2.atlas.de> content-type: text/plain; charset=us-ascii organization: Computing Devices mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (Win16; I) Date: 1996-05-23T00:00:00+00:00 List-Id: 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.