Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to complex array throught DLL

Hello,
 
I'm writing DLL for LabView 7.1. I'm using Borland C++ Builder 6 compilator but I don't think that may be problem to understand what I have on my mind.
 
I have problem with access to LabView complex array data. When I defined complex vector (array 512x1) and I'm accessing it from DLL by Call Library Node Function and showing data from some cells of vector in message I get impossible values.

For example : tab[0].re = -1,54E171, tab[0].im = 0.0000, tab[100].re = 1,29E285; tab[100].im = -1,67E77.
 
Also when I'm filling array in DLL (not reallocating etc, just modyfing existing array) every cells im and re with the same value, for example 0,5 in LabView it is seen as very small values (i.e. 1E-275, 1E-384) or 0.0000 or very large values (i.e. 1E350, 1E175).
 
I'm using following way to acces data:
 
typedef struct {
 long dimSize;
 complex elt[1];
 } TD1;
typedef TD1 **TD1Hdl;
 
where complex is a struct built from two double variables : im and re.
 
And tested library function has code :
 
extern "C" __declspec(dllexport) int test_function(TD1Hdl in)
{
 fftw_plan p;
 TD1 * tbl = *in;
 ShowMessage("[0].re = "+FloatToStrF((*((*tbl).elt)).re,ffFixed,3,3)+' '+
             "[0].im = "+FloatToStrF((*((*tbl).elt)).im,ffFixed,3,3)+' '+
             "[100].re = "+FloatToStrF((*((*tbl).elt+100)).re,ffFixed,3,3)+' '+
             "[100].im = "+FloatToStrF((*((*tbl).elt+100)).im,ffFixed,3,3));
 for (int i=0; i<(*tbl).dimSize; i++)
  {
    (*((*tbl).elt+i)).re = sin(2*i);
    (*((*tbl).elt+i)).im = sin(2*i+1);
  }
 return (*tbl).dimSize;
}
 
Anybody know what is going with that? I have tried many ways to access this data but everytime it doesn't works properly.
 
Best regards,
Darek
0 Kudos
Message 1 of 2
(3,684 Views)
Hi Darek.
 
You should post this question to the LabVIEW forum. This forum is for Measurement Studio questions. Measurement Studio is a product specific to Microsoft Visual C++ and MFC. It does not support Borland.
 
 
0 Kudos
Message 2 of 2
(3,680 Views)