> Can some please explain what i am doing wrong here. i have created a
> Dll from a LV 7.0 vi. The header file looks something like this:
>
> double frequency=10, amplitude=1;
> Power = (TD1 *) malloc(sizeof(TD1));
> (*Power).magnitude = (TD2**)malloc(sizeof(TD2));
> *(*Power).magnitude = (TD2*)malloc(5000*sizeof(TD2));
>
> (*Power->magnitude)->dimSize = 5000;
>
> for (i=0; i<500; i++) {
> (*Power->magnitude)->elt[i] = 0;
> }
>
> Spectrum(frequency, amplitude, Power);
>
> I keep getting Fatal internal error: "memory.cpp", line 593" when it
> tries to call Spectrum. I believe i have allocated memory correctly
> although i may be wrong. (I was getting 'exception' errors before).
> The VI i used to create the Dll contains a basic 'Function Generator'
> (sine wave) and a 'Power Spectrum'.
> I have looked at the Knowledge base and dll examples that come with LV
> 7.0 and have tried setCINArray and NumericArrayResize but have not had
> any luck. It seems like the documentation is for LV 6.0 and 6.1.
>
It looks to me like you are constructing arrays to pass to LV using
malloc, instead of the labview.lib functions for creating or resizing LV
array handles.
You should refer to the manual on Calling External code for details on
the construction of an array.
Greg McKaskle