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,64ea48f34d235bca,start X-Google-Attributes: gid103376,public From: Pam Shimek Subject: ADA-C++ Elaboration Date: 2000/10/11 Message-ID: <39E4DBB5.BEE55D9C@csd.sgi.com>#1/1 X-Deja-AN: 680317549 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@fido.engr.sgi.com X-Trace: fido.engr.sgi.com 971299765 5376731 150.166.39.138 (11 Oct 2000 21:29:25 GMT) Organization: Silicon Graphics Inc., Mountain View, CA Mime-Version: 1.0 NNTP-Posting-Date: 11 Oct 2000 21:29:25 GMT Newsgroups: comp.lang.ada Date: 2000-10-11T21:29:25+00:00 List-Id: Hi, I have an ADA call to a C++ subroutine, which appears to fail at elaboration time. Are there some special linkage flags that gnatmake/gnatlink need to indicate where the C++ linker is? Or is there some interface/pragma that needs to be specified in the ADA code? In particular, I am having problems with const C++ variables failing to initialize during elaboration time: ADA code: *********************************** with text_io; procedure main_ada is procedure SUB_C; pragma import(C, SUB_C); pragma interface_name(SUB_C, "sub_c"); begin SUB_C; end main_ada; ******************************* C++ code: ************************** #include const float a = 100.0; const float b = 3.0; const float c = ( a / b ); extern "C" void sub_c( void ) { float d = a / b; cout << " sub_c" << endl; cout << " a = " << a << endl; cout << " b = " << b << endl; cout << " c = " << c << endl; cout << " d = " << d << endl; } ********************************** The value of the variable "c" reports back 0. Compiled as: CC -n32 -c -g *.cc CC -n32 -g -o main_c main_c.o sub_c.o if (! -e adalib) then mkdir adalib endif cd adalib gnatmake -n32 -k -c -g -j1 -O2 ../main_ada.adb gnatbind -n32 -v -x main_ada.ali gnatlink -n32 -o ../main_ada -g main_ada.ali \ -L/usr/lib32 \ -L/usr/gnu/lib/gcc-lib/mips-sgi-irix6-n32/2.8.1 \ ../sub_f.o ../sub_c.o \ -lftn -lftn90 -lfortran \ -lm -lCsup -lC -lSgw Tried adding --GNATLINK=c++ to the gnatlink line, to no avail. Thanks! Pam