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,fcbbb6164185a4a7,start X-Google-Attributes: gid103376,public From: md4mars@mdstud.chalmers.se (Martin Klang) Subject: linking with C++ Date: 1998/04/20 Message-ID: <6hglkj$dlh$1@nyheter.chalmers.se>#1/1 X-Deja-AN: 346125394 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Chalmers University of Technology Newsgroups: comp.lang.ada Date: 1998-04-20T00:00:00+00:00 List-Id: lately i've been trying out ADA, and even though it's not by a long way as esthetically pleasing as C++, i must confess it's a pretty useful little language. my problem (one of many, though the only one i'll cumber you with): i cannot link to C++ with gnatlink. even compiling the exact same code with g++ instead of gcc will produce an error with gnatlink, which claims the referenced function is undefined. this is what happens: //file cstuff.c #include void c_test() { printf("jah!"); } //file cstuff.c which i compile with: >gcc -c cstuff.c -o c.o >g++ -c cstuff.c -o cc.o //file test.adb procedure Test is procedure C_Test; pragma Import(CPP,C_Test,"c_test"); begin C_Test; end Tester; //file test.adb now, if i do: >gnatmake test -largs c.o it works, but if i do: >gnatmake test -largs cc.o it fails to link. it seems to have no importance in this example whether i use pragma C or CPP (what is the difference anyhow?) comparing c.o and cc.o yields that g++ somewhere along the line renamned the c_test-function to c_test__Fv. Why??? any help much appreciated, martin "Disobedience is the true foundation of liberty. The obedient must be slaves." --Henry David Thoreau, 1847