Hi
I've written a DLL that exports a couple of functions. The first one
allocates a LabView array using DSSetHandleSize, as below:
typedef struct {
int32 dimSizes[2];
unsigned char data[1];
} LABVIEW_2D_BYTE_ARRAY;
typedef LABVIEW_2D_BYTE_ARRAY **LABVIEW_2D_BYTE_ARRAY_HANDLE;
....
error = DSSetHandleSize(lhDiffArray, sizeof(int32)*2+
dim1*dim0*sizeof(unsigned char));
if (error != noErr)
{
*pError = LG_ERROR_MEMORY;
return FALSE;
}
(*lhDiffArray)->dimSizes[1] = dim1;
(*lhDiffArray)->dimSizes[0] = dim0;
The second function takes a LabView array handle and fills the array
with some data. My VI is simple - I have a call library function node
which calls the first function, the array output is wi
red to the input
of a second call library function node which calls the second function
and the array output is wired to a 2D intensity graph control. All
functions accept and return the array as a handle to a 2D array of
unsigned 8 bit ints.
Now, this all works fine, and I can run it as many times as I like.
However, if I run it twice (or more), it causes LabView to crash when
I close the VI (presumably as my DLL is unloaded). The application
error always says that the program tried to write to address
0x00000010. If I remove the graph control, the problem goes away.
Is there something I should be doing to ensure everything gets put
away tidily when the VI closes?
Cheers
mark-r
--
I put ten different puns in my .sig
I hoped that at least one of them would make you laugh
No pun in ten did