Re: Structures and Call_External [message #1863] |
Wed, 23 March 1994 10:21  |
rarback
Messages: 15 Registered: October 1992
|
Junior Member |
|
|
In a previous article, rivers@bnlux1.bnl.gov (Mark Rivers) writes:
> 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.
It appears that IDL structures share the alignment of the "native" machine's
C compiler. In particular, in porting some (inherently nonportable) IDL code
from OpenVMS/VAX to OpenVMS/AXP, the structure alignment went from completely
unpadded (VAX C) to strict member alignment (DEC C).
--Harvey
----
Harvey Rarback phone: (516) 282-5626
CARS fax: (516) 282-7078
Building 815 Internet: rarback@bnlx26.nsls.bnl.gov
Brookhaven National Lab ESnet/SPAN: BNLX26::RARBACK
Upton, NY 11973 BITNET: RARBACK@BNL
|
|
|