Creating arrays of structures with Callable C [message #43500] |
Mon, 18 April 2005 10:29  |
jicicuendez
Messages: 12 Registered: November 2001
|
Junior Member |
|
|
Hi everybody,
I am trying to use callable C/C++ code to generate a plot with IDL
from another application and there are a couple of things that I am
stuck with. Any help will be most appreciated.
First, in the IDL documentation, there is an example of how to create
and structure (page 176). This is done through a two-step procedure of
creating an IDL_STRUCT_TAG_DEF and then creating an structure with the
data itself such as
typedef struct time_series
{
double x[100];
double y[100];
char RGB[3];
int long nElements;
IDL_STRING source[1];
}
TIME_SERIES;
The problem is that in principle the number of elements is not known
until is provided so I would like to substitute this by:
typedef struct time_series
{
double *x;
double *y;
char RGB[3];
int long nElements;
IDL_STRING source[1];
}
TIME_SERIES;
and where memory has been allocated with new. Apparently the structure
can be created in the idl session with the IDL_MakeStruct function but
when I try to use such structure with and idl command it gives a
memory exception. Does anybody know how to avoid this problem?
Cheers,
Juan
|
|
|