LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Freeing Called DLLs in Labview

Hi,
I am using Labview to process a Batch of files. i have written a C++ program and compiled it as DLL using VC++. I call this DLL in a for loop that processes each file. My problem is that with every iteration this will create a new memory space for the program. I dont know how to free up the DLL so that in the next iteration it would not allocate a totally new set of memory but should free up the memory used before and then proceed with the new iteration. I am Using Labview 6.1 and windows 2000 pro. When I tested my DLL in VC++ I put a free library command and it doesnt give me the same problem. Is there a way to free the libraries in Labveiew???

Thanks,
0 Kudos
Message 1 of 4
(2,718 Views)
Shabu,

The way LabVIEW works with DLLs is this:
LabVIEW loads a DLL into memory when that VI that uses a DLL is in memory. If you wany to do what you are talking about, you may try dynamically calling the VI that uses the DLL. However, it sounds like there are memory issues in your DLL that should be taken care of so that this issue will not be present.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 4
(2,718 Views)
What do you mean by Dynamically calling the DLL. I made a VI that only calls this DLL and then I was using that as a Sub-Vi in my main program. Is that what you were telling me to do. Does, re-entrant execution of DLL or sub-vi has an effect on memory usage. My labview program without the DLL runs fine.
0 Kudos
Message 3 of 4
(2,718 Views)
To dynamically call the VI, you will need to use VI Server. (See this for more info.)
If you mark your VI as reentrant and you have not marked you DLL as reentrant in the Call Library Function Node, then the VI will not truly be reentrant. For the DLL to be reentrant, it should be thread safe.
Reentrancy allows more than one copy of a VI to be in memory at a time and be executing.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 4
(2,718 Views)