I have to pass from a VI to a Microsoft Visual C++ DLL, a cluster with some arrays of various data type. The problem is with Double array, that during Visual C debug is incorrect:the dimension is correct passed, but not array data. In the DLL I have inserted the C code genereted by LabVIEW. I tried to pass a cluster of only one array of double, and the results is the same. Then, I tried to pass a cluster with scalar number and the result is correct in only one case. If the double data is the first in the cluster, the result is correct; if the first is another data type, such as integer or boolean, the double data is incorrect during the debug of the DLL. This is the code of my DLL:
// LabViewParam.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include "LabViewParam.h" #include "extcode.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } typedef struct { long dimSize; double elt[1]; } TD2; typedef TD2 **TD2Hdl; typedef struct { TD2Hdl elt1; } TD1; // This is an example of an exported variable LABVIEWPARAM_API int nLabViewParamPass=0; // This is an example of an exported function. LABVIEWPARAM_API int LabViewParamPass(TD1 *pparam) { double parametro; int i; for (i=0;i<(**(*pparam).elt1).dimSize;i++) { parametro=(**(*pparam).elt1).elt[i]; } return 42; } // This is the constructor of a class that has been exported. // see LabViewParam.h for the class definition CLabViewParam::CLabViewParam() { return; } I use LabVIEW 7.0 and Windows XP. Sorry for my english. Thanks to every one for your suggestions. Filippo