[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing structures to CALL_EXTERNAL



In article <7rsd1p$2c3$1@cnn.Princeton.EDU>, jvkepner@muse.Princeton.EDU (Jeremy Kepner) writes:
>  I would like to pass an IDL structure to a function written
>in C via CALL_EXTERNAL.  Does anybody know how to do this.

I have done this in the past.  This was back in IDL 3.5, using FORTRAN rather
than C, on VMS! I would be very surprised if it does not still work fine. It is
not officially supported, presumably because IDL may change the way it
represents structures internally in future releases.

An IDL structure is essentially the same as the equivalent C structure, and
CALL_EXTERNAL will simply pass a pointer to this structure to your C code.
IDL arrays in the structure are "in-line", i.e. the data itself is in the
structure, not a pointer to the data.  However, for strings the structure
contains the string descriptor, not the string data itself.  I don't know about
IDL objects, pointers, etc. since those were all added to IDL since I last used
CALL_EXTERNAL with structures.  If you stick to scalers and arrays of numbers
you should be OK.  Give it a try!

Mark Rivers