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

Home » Public Forums » archive » CALL_EXTERNAL
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: Call_external [message #9287 is a reply to message #1268] Thu, 12 June 1997 00:00 Go to previous messageGo to previous message
Inigo Garcia is currently offline  Inigo Garcia
Messages: 13
Registered: June 1997
Junior Member
Harald Frey wrote:
>
> 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


Hi Harald:

The compiling to use a Fortran subroutine from IDL is the second one you
mention, the "ld -G -o example.so example.o". The error you get is due
to the fact that IDL does not find the entry "_sum_array_" in the file
"example.so". The most probable thing is that the entry is called
"sum_array_", at least in Solaris is that way. To verify the enties that
one of your subroutines have, you can use the command "nm example.o".

Anyway, with your program written like this nothing is going to work,
because you need to use an Interface between IDL and the Fortran
Routine. How to do this is explained in the Online Help of IDL, in the
Advanced Development Guide, CALL_EXTERNAL Section. The example files are
in the /external/sharelib/ directory of the main IDL directory.

Enjoy it !!

I~nigo.
--
\\|//
(o o)
+-----------------------oOOo-(_)-oOOo----------------------- --+
| I~nigo Garcia Ruiz |
| Kapteyn Instituut Phone: +31-(0)50-3634083 |
| Landleven 12 Fax: +31-(0)50-363 |
| 9747 AD GRONINGEN (Netherlands) e-mail: iruiz@astro.rug.nl |
+----------------------------------------------------------- --+
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: problems accessing Ken Bowman's IDL page?
Next Topic: Re: From tvscale to cgImage, puzzling feature in the plot

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

Current Time: Wed Oct 08 12:25:21 PDT 2025

Total time taken to generate the page: 0.00408 seconds