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,start X-Google-Attributes: gid103376,public From: Norbert Roeben Subject: Interface between ADA and C++ Date: 1996/05/22 Message-ID: <31A2C469.41C6@essiris2.atlas.de>#1/1 X-Deja-AN: 156081482 content-type: text/plain; charset=us-ascii organization: STN Atlas Elektronik mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; IRIX 5.2 IP22) Date: 1996-05-22T00:00:00+00:00 List-Id: Hi, I'm trying to find a way to interface ADA with C++. I'm using GNAT 3.03 with gcc 2.7.2 with g++ library 2.7.1. I try to call an C++ function from Ada. The linker always searches for C - function, not for a C++ - function. Does anybody has a solution for this ? Here an extract from my sources and the way I compiled them : ADA Sources : file hellointerface.ads : package HelloInterface is procedure CppHello ( Text : String ); private -- Interface to a C++ - function pragma Import ( Cpp,CppHello,"CppHello"); end HelloInterface; file hello.adb : with text_io; with HelloInterface; procedure Hello is begin HelloInterface.CppHello ("And it works with C++"); end; C++ Source : file cppHello.cc : #include void CppHello ( char *String ) { cout << String << endl; } The way how I compiled them: gcc -g -c hello.adb gcc -g -c hellointerface.ads g++ -g -c cppHello.c gnatbl hello.ali -o hello cppHello.o cHello.o -lg++ -lstdc++ The Error Message I got : No code generated for file hellointerface.ads (package spec) No code generated for file except.ads (package spec) collect2: ld returned 1 exit status /usr/bin/../lib/ld: Unresolved: CppHello -- +-----------------+----------------------+-------------------------------+ | Norbert Roeben | DEPARTMENT : ETS 52 | PHONE : (49) 421-4573695 | +-----------------+----------------------+-------------------------------+ | EMAIL : roeben@essiris2.atlas.de | +------------------------------------------------------------------------+ | STN ATLAS Elektronik Brueggeweg 54 28305 Bremen | +------------------------------------------------------------------------+