Hello,
I'm working on DLL (in Borland C++ Builder 6) for LabView (LabView 7.1)
which makes operations on double arrays;
1) When I try to use Adapt To Type when passing 1-D double (not complex)
array.
From LV we get declarations:
typedef struct {
long dimSize;
double elt[1];
} TD1;
typedef TD1 **TD1Hdl;
long _for_real(TD1Hdl input)
when I try to read dimSize everything is OK, also when I'm operating od int
(CV long) array everything is OK, I can fill matrix properly and there's not
problem in read data from matrix. When we change data type to double
something going wrong.
We use LV double 8-byte (15bit precision), and in BC++ also we use double
(8-byte, 15-bit precision). And we tried following methods to access data:
long _for_real(TD1Hdl input)
{
1) TD1 * tbl = * input;
1) tbl->elt[1] = 2.5;
2) (* (*input)).elt[1] = 2.5;
3) *((*(*input)).elt+1) = 2.5;
}
I writed this for one element, but in loops these methods don't work -
sometimes we get memory access violation, sometimes we get unbelively values
like 1.3E234, -5.3E334, 4.3E-275 and many similar (when we use loops to fill
data with the same values we get different when we're checking it in
LabView).
2) When against Adapt To Type we use pointer to 1-D double array, everything
is ok, we can modyfing data, read and what else we want.
long _for_real(double * input)
{
1) input[3] = 2.5;
2) *input(i+3) = 2.5;
}
Can anybody tells me what I'm doing wrong in my DLL? I thing that any error
I can make is in access to array by pointer, but these methods working very
good on integer arrays..
I'll be very thankful for any help or suggestions.
Best regards,
Darek