Reorem wrote:
> I have programmed a DLL (with Microsoft Visual C/C++) that performs a
> pure delay of a digital signal (z-delay), y[n] = x[n-D].
>
>
> The DLL creates a global buffer of the same size as the needed delay,
> to save the previous samples.
>
> Labview calls the DLL using a VI. When using this VI in the labview
> application the DLL performs correctly.
>
> But when I use or call several times the same VI, that contains the
> DLL, in the same
> labview application, the DLL works incorrectly mixing the data from
> the different calls (it seems the global buffer is shared between the
> different VIcalls that contain the DLL).
>
> Is possible to use the same DLL (with internal global variables) in
> the same application without sharing the same global
variable to
> different call? Diferenciatig the global scope to each VI call.
No, you can't really do that. Since the operation you want to do is so
simple, way go to the trouble of creating a DLL at all? Just create a VI
and store the information in a shift register. Make that VI reentrant
and you have exactly what you want.
If you really need to create a DLL for whatever strange reasons, still
do the same shift register VI and call your function with the array from
the shift register as one parameter. Make the parameter Adapt To Type,
pass pointer to handles and reference the array inside the DLL. But the
operation really needs to be very complicated and almost impossible to
do in LabVIEW to make this the effort worthwhile.
Rolf Kalbermatter