Re: The CALL_EXTERNAL function [message #6295] |
Tue, 21 May 1996 00:00 |
dave
Messages: 31 Registered: February 1994
|
Member |
|
|
>>>> > "Scott" == Scott McIntosh <scott@astro.gla.ac.uk> writes:
Scott> Hi guys/gals, Please can someone help me, I am at my wits'
Scott> end. I am attempting to use call_external function to call
Scott> a 'C' program (eg example.c) , which itself calls F77
Scott> subroutines (eg example1.f). The example routines I am
Scott> quoting are contained in the IDL User/Ref manuals, but
Scott> being able to run these would give me great insight into
Scott> running the routines I desire. The basic problem seems to
Scott> be using the 'ld' command to create the necessary shareable
Scott> library, and is not a compilation problem , I think !!!!!!
Scott> Any help that you can provide would be most
Scott> appreciated.
Scott> Thanks, Scott
Compile with the -KPIC or -Kpic options (-PIC if using GCC), and link
with the -G option:
# module.c uses libm.a and libmy_stuff.a
cc -Kpic -o module.o module.c
ld -G -o module.so -L~/mylibs -lmy_stuff -lm module.o
I use this to call LAPACK fortran routines from a C wrapper. Because
of the huge number of symbols, I have to compile LAPACK with -KPIC.
Good luck,
David.
|
|
|