comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Call_External and the C Math Library
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Call_External and the C Math Library [message #6306] Fri, 07 June 1996 00:00
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On 6 Jun 1996, Charles Cavanaugh wrote:
> Has anyone experienced problems getting IDL's call_external to behave
> when called on C code that uses the standard C math library? I have
> some C routines that use pow and sqrt, and when call_external was
> dumping core, I tracked the problem down to the lines that contained C
> math library calls. Math.h is included in the C code, and -lm is on
> the link line. I tried using an explicit interface in the C code
> (ie. double sqrt (double);), but that didn't help. Has anyone seen
> this before and found a fix?

What platform are you using?

I have "external" routines which use C maths library routines.
The platform I use most of the time is DEC ALPHA/OSF, and on it I link:
ld -shared -no_archive -o mylib.so *.o -lc -lm
(I use the regular DEC C compiler.)

I've ported the code to some other platforms. I haven't much experience
with these, and I had to experiment a little to get it all to work.
In particular, I originally specified -lc (and maybe -lm) in the SUNOS 4.1.3
link, and the compiled code worked on "my" machine, but crashed when ported
to another. Linking without any -l? switches seemed to allow porting.

I've found the following to work (well, for me, anyway):
SGI - IRIX 5.2 (SGI's c):
ld -shared -no_archive -o mylib.so *.o -lc
SUN - Solaris (SUNOS 5.4?) (gcc):
ld -dy -G -o mylib.so *.o -lc
SUN - SUNOS 4.1.3U1 (gcc):
ld -o mylib.so -assert pure-text *.o


Hope this helps

Peter Mason
CSIRO division of Exploration and Mining
P.O Box 136, North Ryde, NSW, 2113, Australia
E-Mail: peter.mason@dem.csiro.au Tel: +61 2 887-8883 Fax: 887-8921/8909
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: newbie: why doesn't !P.MULTI work here?
Next Topic: Re: Can I do this without using loops?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:36:52 PDT 2025

Total time taken to generate the page: 0.00493 seconds