CALL_EXTERNAL [message #31535] |
Fri, 19 July 2002 03:15 |
Ian Dean
Messages: 26 Registered: January 2000
|
Junior Member |
|
|
Hi,
I'm running IDL 5.4 under VMS (!!!), and would like some help using
CALL_EXTERNAL to a C routine.
The C routine has a sinle parameter passed to it, but it is a structure
(similar to that below)
The routine returns to the caller a variable sized array starting at the
address of item buffer and the number of elements in buff_size. (Other
control fields are also used but I won't cloudy the water with these).
typedef struct
{
void *buffer;
int buff_size;
}ACCESS
This routine and structure are already in use between several other C
routines. I just want to use the same idea in IDL.
I have created a similar structure in IDL
ACCESS = {buffer: ????, buff_size:0L, ident:0L}
The question is - what should the buffer tag be defined as?
I have tried it as a scalar (0L - Addresses are long ints) but I get an
access violation
I have tried a pointer - but this causes an access violation (it passes
address 1,2,3... etc.)
I have tried an array - this didn't crash, but overwrote the other fields
I have tried setting it to array[0] - this also failed dramatically
Since CALL_EXTERNAL passes individual parameters by reference, is it
possible for me to get the reference of a variable internally (similar to
%LOC in Fortran)?
I hope I've explained this sensibly - I am not really a C programmer.
Any help would be gladly received
Regards,
Ian
|
|
|