comp.lang.ada
 help / color / mirror / Atom feed
From: "AJAskey" <AskeyAJ@gmail.com>
Subject: Trig Function Linking Problems
Date: 16 Apr 2007 13:32:42 -0700
Date: 2007-04-16T13:32:42-07:00	[thread overview]
Message-ID: <1176755562.190964.167640@w1g2000hsg.googlegroups.com> (raw)

Hi.  We are moving some software from and ancient workstation to a
newer one.  The environment is still several years old but newer than
the old-timer we are leaving.  We cannot get the TRIG functions to
work as there appears to be a problem interfacing to the library.  The
following test code works on the old-time system, but fails on two
separate newer systems.  Any help would be greatly appreciated.

with ada.text_io;
  use ada.text_io;
with ada.numerics.elementary_functions;
procedure TRIG is
  a,b,c,d : float;
begin
  a := 3.1415/4.0;
  b := ada.numerics.elementary_functions.sin(x=>a);
  c := ada.numerics.elementary_functions.cos(x=>a);
  d := ada.numerics.elementary_functions.tan(x=>a);
  put_line("sin(a)" & float'image(b));
  put_line("cos(a)" & float'image(c));
  put_line("tan(a)" & float'image(d));
  put_line("a     " & float'image(a));
end TRIG;

>From system with  : GNATMAKE 3.13p  (20000509) Copyright 1995-2000
Free Software Foundation, Inc.
gcc 2.96
Linux Red Hat 7.1 2.96-98


[I don't need to do anything special except a gnatmake.]

>>gnatmake trig
gnatgcc -c trig.adb
gnatbind -x trig.ali
gnatlink trig.ali

>>trig
sin(a) 7.07090E-01
cos(a) 7.07123E-01
tan(a) 9.99954E-01
a      7.85375E-01

---------------------------------------------

>From new system with : GNATMAKE 3.2.3-13  (20030502) Copyright
1995-2000 Free Software Foundation, Inc.
gcc 3.2.3
Linux Red Hat 3.2.3-53

>>gnatmake trig
gcc -c trig.adb
gnatbind -x trig.ali
gnatlink trig.ali

>>trig

raised CONSTRAINT_ERROR : s-imgrea.adb:236


[I tried linking in the -lm library which is required in the "c"
version of this test.  I also tried linking a few others, but
continued to get the run-time error.

On another similar system, the program ran but returned NaN in the
debugger for b,c,d after the sin,cos,tan calls.  I assume it really
isn't finding the library.]

>>gnatmake -c trig.adb
>>gnatbind -x trig
>>gnatlink -lm -lc -lgnat trig

>>trig

raised CONSTRAINT_ERROR : s-imgrea.adb:236


Any ideas what I should be linking in?

Thanks much.
Andy




             reply	other threads:[~2007-04-16 20:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16 20:32 AJAskey [this message]
2007-04-16 22:46 ` Trig Function Linking Problems Jeffrey Creem
2007-04-16 23:39   ` Markus E Leypold
2007-04-17  9:59     ` AJAskey
2007-04-17 10:55       ` Markus E Leypold
2007-04-17 11:48         ` AJAskey
2007-04-17 12:05           ` Markus E Leypold
2007-04-17 12:32       ` Ludovic Brenta
2007-04-17  0:22 ` Jeffrey R. Carter
2007-04-17 16:58 ` Dirk Heinrichs
2007-04-17 18:54   ` AJAskey
2007-04-17 20:50     ` Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox