Hi all!
I want to pass an array of cluster including a double array to a C DLL. I use a Call Library Node to Call the DLL. The Datatype of the input parameter is Adapt to Type with Array Data Pointer. It is working with an integer 32 array but when i want to change to a double(float64) array LabView even crashes.
Here is the source code of the working DLL.
#include "stdafx.h"
#include "extcode.h"
#include <stdlib.h>
/*Typedefs*/
typedef struct {
int32 dimSize;
int32 elt[1];
} TD1;
typedef TD1 **TD1Hdl;
typedef struct {
TD1Hdl elt1;
TD1Hdl elt2;
TD1Hdl elt3;
LStrHandle elt4;
} TD2;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
_declspec(dllexport) void ImportClusterArray(TD2 *input, TD2 *output, long *arraylength, long *i1, long *i2, LStrHandle LVString);
_declspec(dllexport) void ImportClusterArray(TD2 *input, TD2 *output, long *arraylength, long *i1, long *i2, LStrHandle LVString)
{
int i,j;
for(i=0; i<*arraylength;i++)
{
//output[i].elt2 = (long) input[i].elt2 * 2;
}
*i1 = (int32) (*(input[0].elt1))->dimSize;
(*(output[0].elt1))->dimSize = *i1;
for(i=0;i<*i1;i++)
{
(*(output[0].elt1))->elt[i] = (int32) ((*(input[0].elt1))->elt[i]) * 2;
}
*i2 = (int32)(*(input[0].elt2))->dimSize;
(*(output[0].elt2))->dimSize = *i2;
for(i=0;i<*i2;i++)
{
(*(output[0].elt2))->elt[i] = (int32) ((*(input[0].elt2))->elt[i]) * 2;
}
(*(output[0].elt3))->dimSize = (int32)(*(input[0].elt3))->dimSize;
for(i=0;i<(*(output[0].elt3))->dimSize;i++)
{
(*(output[0].elt3))->elt[i] = (int32) ((*(input[0].elt3))->elt[i]) * 2;
}
for(j=0;j<*arraylength;j++)
{
for(i=0;i<(*(input[j].elt4))->cnt;i++)
{
(*(output[j].elt4))->str[i] = (*LVString)->str[i];
}
}
}
When i want to change the integer Array to a double array
/*Typedefs*/
typedef struct {
int32 dimSize;
float64 elt[1];
} TD1;
typedef TD1 **TD1Hdl;
typedef struct {
TD1Hdl elt1;
TD1Hdl elt2;
TD1Hdl elt3;
LStrHandle elt4;
} TD2;
And the rest of the code is adapted to float64 too. If I changed the array type, LabView chrashes with this error:
Can anyone help me please?
Thanks a lot.
Eumel