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

Home » Public Forums » archive » IDL calling a Fortran routines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL calling a Fortran routines [message #44216 is a reply to message #44186] Sat, 28 May 2005 20:36 Go to previous messageGo to previous message
ismxray@yahoo.com is currently offline  ismxray@yahoo.com
Messages: 13
Registered: January 2005
Junior Member
I can use intel fortran v8.1 compile the testing program but not g77.
However, when I try to call the subroutine in IDL, I got the following

error messages:
IDL>x=findgen(10)
IDL>sum=0.0
IDL>aa=call_external('example1.so', $
'SUM_ARRAY',x,n_elements(x),sum)

% CALL_EXTERNAL: Error loading sharable executable.
Symbol: SUM_ARRAY, File = example1.so

/home/tangsk/software/idl61/idl_6.1/bin/bin.linux.x86/libidl .so.6.1:
undefined symbol:
SUM_ARRAY

the command to compile is
f90 -c example1.f
f90 -shared -o example1.so example1.o

Did I missed some parameters while compiling? Thanks!


The fortran code is:
c-------------------------------------------------------
SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv are integers

j = LOC(argc) !Obtains the number of arguments (argc)
!Because argc is passed by VALUE.

C Call subroutine SUM_ARRAY1, converting the IDL parameters
c to standard FORTRAN, passed by reference arguments:

CALL SUM_ARRAY1(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)))
RETURN
END

c This subroutine is called by SUM_ARRAY and has no
c IDL specific code.
c
SUBROUTINE SUM_ARRAY1(array, n, sum)
INTEGER*4 n
REAL*4 array(n), sum

sum=0.0
DO i=1,n
sum = sum + array(i)
ENDDO
RETURN
END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: isurface transparency not showing lines and points
Next Topic: Re: printing IDLgrScene

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

Current Time: Fri Oct 10 02:00:18 PDT 2025

Total time taken to generate the page: 0.64101 seconds