Call_external and link libraries - SunOS [message #4023] |
Wed, 19 April 1995 00:00 |
keith
Messages: 7 Registered: July 1993
|
Junior Member |
|
|
I wonder if anyone can offer any suggestions on the following problem. I
am attempting to use CALL_EXTERNAL to interface to a FORTRAN
subroutine, using IDL 3.5 and Sun Fortran 1.4 running under SunOS
4.1.3_U1. I have a C wrapper to pass the arguments to the FORTRAN.
The problem is that the FORTRAN code makes calls to the math library
- simply the cosine function _Fcos. However when I build the
shared-object file, viz
% cc -c -pic idl-link.c
% f77 -pic -c -O approx.f
% ld -o approx.so -assert pure-text *.o /usr/lang/SC1.0/libF77.so.1.4.1
and call "approx.so", IDL crashes because the binary makes an
unsatisfied reference to _Fcos.
Allright, _Fcos is in the math library /usr/lang/SC1.0/libm.a so I
should link *that* into assert.so just like I did with the FORTRAN
support library above. BUT in SunOS, there is only a static version
of this library! (ie no libm.so).
Second try. Extract the relevant objects from libm.a with "ar" and
link them in. But the link with "-assert pure-text" fails because
they are not position-independent code. Presumably this is why
there is no dynamic version of libm.a.....
Is this a general problem? Or one specific to the particular software
versions I am using? Any ideas for how to fix it would be
appreciated.
One other point - if anyone knows of IDL code to fit Chebyshev
polynomials to an X-Y (1d) dataset I'd be vary grateful for
a pointer. "approx.f" above is the netlib routine to do that,
but I suspect it would be easier in IDL alone.
sincerely
Keith Refson
--
------------------------------------------------------------ ------------------
| Email : keith@earth.ox.ac.uk | Dr Keith Refson, Dept of Earth Sciences|
| TEL(FAX): +44 1865 272026 (272072)| Parks Road, Oxford OX1 3PR, UK |
------------------------------------------------------------ ------------------
|
|
|