Re: CALL_EXTERNAL + structures + arrays [message #21786] |
Thu, 21 September 2000 00:00 |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
Matthew Newcomb wrote:
>
> G'day,
>
> I'm writing some C code to read compressed data files. The function
> takes a structure argument which has one of the fields as an array. I
> want to be able to dynamically resize this array. The structure looks
> like:
>
> devInfo={devInfoStr, epoch:0L, creationTime:0L, numlines:0L,
> linesPerType:LONARR(256), bytesPerType:LONARR(256), lenScanList:0L,
> devName:'' , scanlist:????? }
>
> The field I'm talking about is the 'scanlist' field. The scanlist can
> be size 1 to UINTMAX. How can I may it an array of bytes?
>
> Thanks for any suggestions.
>
> Matt
It might be time to bite the bullet and get into LINKIMAGE or DLMs.
Then you could create your devInfoStr structure in your C code, and
scanlist could be an array of any size, of any type.
Or, to be more sneaky, you could create the structure in IDL, pass
it into your C code where you could change the dimensions of the
structure
and allocate a new area of memory for it. Of course, this may create
core
leaks or seg. faults if you are not very careful.
--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
|
|
|