From: Pam Shimek <pshimek@csd.sgi.com>
Subject: ADA-C++ Elaboration
Date: 2000/10/11
Date: 2000-10-11T21:29:25+00:00 [thread overview]
Message-ID: <39E4DBB5.BEE55D9C@csd.sgi.com> (raw)
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 <iostream.h>
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
next reply other threads:[~2000-10-11 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-11 0:00 Pam Shimek [this message]
2000-10-11 0:00 ` ADA-C++ Elaboration Ted Dennison
2000-10-14 3:40 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox