User | Kudos |
---|---|
8 | |
6 | |
5 | |
4 | |
3 |
Does anybody else have issues with NumericArrayResize?
I am running windows 7 x64, 32 bit labview, and creating a 32 bit dll. There is a bug on the packing of the structure for doubles. I had to add a #pragma pack(1) to the code for my configuration.
I modified an example off the NI website/help as follows. The example originally uses uint8, change the code for doubles and it did not work. I think the "extcode.h" has improper #if/#defines for checking system configuration.
#include "extcode.h"
#pragma pack(1)
typedef struct {
long dimSize;
double elt[1];
} TD2;
typedef TD2 **TD2Hdl;
_declspec (dllexport) long sizeToTen(TD2Hdl array);
_declspec (dllexport) long sizeToTen(TD2Hdl array)
{
double * temp;
MgErr error;
error = NumericArrayResize(fD, 1, (UHandle *)(&array), 10*sizeof(double));
(*array)->dimSize = 10;
temp = (*array)->elt;
temp[3] = (double)1;
temp[7] = (double)2;
temp[9] = 255;
return error;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.