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

Home » Public Forums » archive » "Share data with external processes"
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: "Share data with external processes" [message #7766 is a reply to message #7762] Thu, 16 January 1997 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Ken Stone <k.a.stone@larc.nasa.gov> writes:

> Does anyone know of a fast way to transfer a large array (say
> fltarr(2000)) from another process? My first thought was to write the
> data to a file, and then read it back into IDL. But time is of
> a critical nature in this case. Then I found CALL_EXTERNAL, but it
> seems to only return a scalar (Is that true?).

Well, this is *literally* true, but it's not what you mean.
CALL_EXTERNAL accepts parameters just like any other IDL
procedure or function and these parameters can be passed by
reference or by value to the C program. Your large array will
be one of these parameters. You can think of it as sort of an
output parameter to a normal IDL procedure.

The only real caveat to using CALL_EXTERNAL to pass data is
that the variable must be created and sized on the IDL side.
You can fill it on the C side, but don't change its data type or
size. Your code will look something like this:

dataArray = FLTARR(2000)
junk = CALL_ETERNAL('fill_it.so', 'fillarray', dataArray)
PLOT, dataArray

The first two parameters to CALL_EXTERNAL are the name of the
shared object library you have to create and the entry point name
into that library (i.e, the function in the library you are calling).

The only difficult part of using CALL_EXTERNAL (and it is not
*always* difficult) is getting the shared object module made
correctly. This is compiler and operating system specific. RSI
provides lots of example Make files to help with this, but if
you have a wierd compiler you are sometimes on your own.

> LINKIMAGE now looks
> like the way to go. Has anyone had any luck using LINKIMAGE to pass
> around arrays like this? What _is_ the best way to "share data with
> external processes"? (I put that in quotes because it's in the RSI
> advertisement for IDL. :-))

LINKIMAGE is harder to use than CALL_EXTERNAL and requires that
you know significantly more about how IDL works internally. I would
say you pretty much have to be an expert C programmer to work with
LINKIMAGE, while even someone like me can usually get CALL_EXTERNAL
to work. ;-)

Good luck!

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Revolutionary Software
Next Topic: IDL FAQ

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

Current Time: Sun Oct 12 11:17:43 PDT 2025

Total time taken to generate the page: 0.87773 seconds