04-19-2011 04:15 AM
Two problems appear for me when using the setup below.
First, I have a vi for opening a secondary vi:
Then I have a vi for calling the opened, secondary vi:
These two are compiled to a dll. The first one is called once, calling a function "open(char *)". The second one is called over and over, calling a function nextevent(double *, int). A simple example of an opened, secondary vi looks like this:
The code used to send data looks approximately like this:
dataout = malloc(dx->numelems * sizeof(double));
datain = (COMPLEX *) dx->cont;
for (i = 0; i < dx->numelems; ++i)
{
dataout[cnt][i] = sqrt(datain[i].re * datain[i].re + datain[i].im * datain[i].im);
}
nextevent(dataout, dx->numelems);
free(dataout);
This code is called in a loop. dataout is a double array to be sent to the secondary vi, datain is the source data.
The problem now is that there is something eating up memory, and I fail to see why.
My second question is this:
I want to insert a Hamming window, or some other form of windowing function. It doesn't work however, and the help tells me it is because a vi opened this way cannot contain any polymorphic vi. Is there a convenient way around this problem?
04-20-2011 02:28 AM
Regarding your second question:
As you say not possible to use a polymorphic vi in a DLL and in your case it is the windowing VI that is polymorphic. What you can do is to use only one instance of the windowing VI in the short cut menu.
Here is a link to a report about this error in the knowledgeBase:
http://digital.ni.com/public.nsf/allkb/755CE99505A1C9FF8625693C00508DDE?OpenDocument
04-26-2011 02:43 AM
Nope, doesn't work. I get an error when the vi is opened:
04-26-2011 06:24 AM
I was of course wrong about the memory leak. It looked like LabView caused it, but it was a leak that went undetected in our system, for some reason.
Apologies if anybody needlessly looked into this.
04-26-2011 08:03 AM
Nice that you got your first question sorted out.
Regarding the missing subvi: I have difficulty to reconstruct your error but it seems that you get passed the issue that you wrote in your first post. In that case I'm guessing the problem now lies in building of your dll. I think the following forum thread handles the same issue (based on the assumption that this is due to the building of the DLL.
http://forums.ni.com/t5/LabVIEW/Missing-subvi-from-ni-aalbase-lvlib/td-p/1031024
Does it help or am I wrong about the error message?