LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crash when passing a pointer of an initialized U8 array to my dll file.

I need to pass the pointer of an initialized 1D array of U8 type to my Dll file. At first, I set the length of the 1D array and initialized it. Then I configured the Call Lib Node and made the input parameter as 1D Array Pointer of U8 type. The prototype of the called function in my Dll file is:

EXPORT void Grab(unsigned char *LVPict)

Also, I had a goble pointer of 1D buffer in my Dll file, defined as LPBYTE pImage, and I wrote the data in the goble buffer to the 1D array, using

for (DWORD i=0; i
But after I run the VI, LabView crashed down every time until I reduced dwSize, the legth of buffer, to 1. That means, I can not write anything from the buffer
to the array.

I'm very very sure the array initialized in LabView is far far huge than the goble buffer.
0 Kudos
Message 1 of 2
(2,593 Views)
It's because the array is not set up like the standard C array. Read "Using External Code in LabVIEW" in LabVIEW's help. Also, if you right-click on the Call Library Node and select the option to create a header file, the header file will show the data structure more clearly.
0 Kudos
Message 2 of 2
(2,593 Views)