Call_external [message #9225] |
Thu, 05 June 1997 00:00 |
Harald Frey
Messages: 41 Registered: March 1997
|
Member |
|
|
I have changed from VMS to UNIX and now I got a problem with
call_external and
I'm not sure if it is an IDL or a UNIX problem. I work under
{ sparc sunos unix 4.0.1c}.
The FORTRAN program example.f according to the User's Guide 18-14
C --------------------------
subroutine sum_array(array,n,sum)
integer*4 n
real*4 array(n),sum
sum=0.0
do i=1,n
sum=sum+ array(i)
print*, sum, array(i)
enddo
return
end
C --------------------------
And the IDL program test_call.pro
; -------------------------
pro test_call
x=findgen(10)
s=call_external('example.so','_sum_array_',x,n_elements(x),/ f_value)
end
; ------------------------
Compiling the FORTRAN program with (User's Guide 18-21)
f77 -c -pic example.f
ld -o example.so example.o
Gives the error message
% ld -o example.so example.o
Undefined first referenced
symbol in file
__e_wsle example.o
__s_wsle_nv example.o
__do_l_out example.o
ld: fatal: Symbol referencing errors. No output written to example.so
Trying
ld -G -o example.so example.o
compiles without error message but then in IDL I get
IDL>.r test_call
IDL> test_call
% CALL_EXTERNAL: Error loading sharable executable.
Symbol: _sum_array_, File = example.so
ld.so.1: /usr/local/idl/bin/bin.solaris2/idl: fatal:
dlsym:
can't find symbol: _sum_array_
% Execution halted at: TEST_CALL 4 test_call.pro
% $MAIN$
Where is the problem?
Harald Frey
Space Sciences Laboratory
University of California
Berkeley, CA 94720
hfrey@ssl.berkeley.edu
|
|
|