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

Home » Public Forums » archive » Re: Structures and 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: Structures and Call_External [message #1872 is a reply to message #1863] Tue, 22 March 1994 20:29 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <Kile_Baker-180394122621@bakers-mac.jhuapl.edu> Kile_Baker@jhuapl.edu (Kile Baker) writes:
> I have some complicated structures that are used with C routines and I
> would
> like to pass this data into an equivalent structure in IDL. I know I can
> do it by passing the original structure in as a byte array and then
> uppacking the byte array in IDL, but that is a slow process. Is there any
> way of passing
> the structure directly in to an IDL structure?
>

Passing structures to/from IDL with CALL_EXTERNAL is officially
unsupported. HOWEVER, it does presently work. What is passed is the
address of the first element in the structure. So you can define an IDL
structure which is the same as your C structure, pass its address in
CALL_EXTERNAL, and use memcpy to copy the data from the C structure to the
IDL structure. The only caveat at present is that your IDL structure cannot
contain strings, because these are passed by descriptor in the
structure. You can use BYTE arrays in place of strings. Other than
strings the IDL structures allocate memory sequentially for each element
just as C does. On some platforms there may be data alignment issues
which you will have to determine empirically.

This is not guaranteed to continue to work, since RSI may change the
way structures are stored internally. Such a change could be made to
allow array sizes to change inside a structure.

I am routinely passing structures, and arrays of structures, with
CALL_EXTERNAL on IDL under VAX/VMS. I am quite sure it will work on
other platforms as well. Be aware that it could break in a future
release...


--
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave.
[Message index]
 
Read Message
Read Message
Previous Topic: map projection polygon problem
Next Topic: Re: map projection polygon problem

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

Current Time: Sun Oct 12 04:46:23 PDT 2025

Total time taken to generate the page: 0.87568 seconds