I'm using a DLL generated with LabVIEW 7.1 to calculate IIR filter coefficients in a application I'm writing in C++. The DLL contains several different functions. The function prototype in question looks like this:
long __cdecl ButterworthCoefficients(unsigned long filterType,
double samplingFreqFs, long order, double lowCutoffFreqFl,
double highCutoffFreqFh, TD1 *IIRFilterCluster);
where "TD1" is an output that contains the IIR filter coefficients generated by the function. TD1 looks like this:
typedef struct {
unsigned long filterStructure;
TD2Hdl ReverseCoefficients;
TD2Hdl ForwardCoefficients;
} TD1;
TD2Hdl is a handle to a 1-D array containing doubles.
My question relates to how to pass the TD1* parameter into the function. If I simply declare TD1 and leave it uninitialized and pass it's address to the function I get a windows access violation read error. So I assume I have to create and populate the entire TD1 structure in my C++ source file, allocating memory for the arrays, before passing the TD1 address to the function. When I try to do that I get a LabVIEW error "Fatal Internal Error memory.cpp, line 638".
Any ideas on how to make this work?