Hi.
I'm trying to use CIN to up-down flip a two dimensional array passed from LabVIEW. Everything seems to work fine when I run the .vi (flipper.vi). However, when I run another .vi (save_data.vi) that uses the flipper subroutine, it crashes LabVIEW.
Specifically, I recieve a LabVIEW.exe - Application Error:
The instruction at x-location referenced memory at y-location. The memory could not be "read".Now I understand that somewhere along the lines LabVIEW accesses corrupt memory, due to a lack of array initialization or something. Unfortunately, that's about all I understand.
I'm using LabVIEW 8.0. Here is my flipper CIN code:
/* CIN source file */
#include <extcode.h>
/* stubs for advanced CIN functions */
UseDefaultCINInit
UseDefaultCINDispose
UseDefaultCINAbort
UseDefaultCINLoad
UseDefaultCINUnload
UseDefaultCINSave
/* Typedefs */
typedef struct {
int32 dimSizes[2];
int16 Numeric[1];
} TD1;
typedef TD1 **TD1Hdl;
extern "C"{
MgErr CINRun(TD1Hdl dataIn, TD1Hdl dataOut);
}
MgErr CINRun(TD1Hdl dataIn, TD1Hdl dataOut)
{
int32 rowSize = (**dataIn).dimSizes[0]; // number of rows of data
int32 colSize = (**dataIn).dimSizes[1]; // number of columns of data
(**dataOut).dimSizes[0] = rowSize;
(**dataOut).dimSizes[1] = colSize;
// up-down flip of data
int32 i, j, arrayIndex;
for(i = 0; i < rowSize; i++)
{
for(j = 0; j < colSize; j++)
{
arrayIndex = colSize*i + j;
(**dataOut).Numeric[arrayIndex] = (**dataIn).Numeric[arrayIndex];
}
}
return noErr;
}Let me know if you have any ideas on how to possibly initialize the data that I'm passing into the CIN.
Hopefully this makes some sense. Thanks,