Hello,
I'm writing Dynamic Library (DLL) which should operate on complex matrix, and I have a problem with function parameters.
My target is DLL which uses FFTW libraries for calculating Fast Fourrier Transformate on complex signals given by matrix.
How should I define function? I make it on many ways,
extern "C" __declspec(dllexport) int fast_fourrier(fftw_complex * in, fftw_complex * out, int size)
extern "C" __declspec(dllexport) int fast_fourrier2(complex * in, complex * out, int size)
extern "C" __declspec(dllexport) int fast_fourrier3(TD1Hdl input, TD1Hdl output);
where TD1Hdl is
typedef struct {
long dimSize;
complex elt[1]; (or cmplx128 elt[1]; )
} TD1;
typedef TD1 **TD1Hdl;
There's only one method which works:
extern "C" __declspec(dllexport) int function(double * re, double * im, double * re_out, double * im_out, int size);
But it's very time-consuming, because I must build another dynamic matrix and write into data from re and im. After calculating FFTW I must separate data onto re_out and im_out. But I think must be easier way to do this, but I'm don't now how to do this.
I'm don't know how to get into the data elt in structure TD1Hdl whitch is used by LabView when calling function on array 1D, type double 8-bytes by Array Handle. I can easily read the dimSize when we connecting to Call Library Function an array, but any modification on substructure elt crashes LabView. I think, that elt is pointer for first element of the matrix but maybe I'm wrong.
I show, that we can also pass a parameters by something like "Adapt to type", which is prototyped by function (void * arg1) and I have absolutely no idea what can I do with this param.
Maybe anybody has writed a external DLL operating on complex array and can help. I'll be grateful for any advices.
Best regards,
Darek