Showing results for 
Search instead for 
Did you mean: 

c++ dll in labview keep memory between calls?


I'm trying to optimizing a program made of a model implemented in c++ and a labview interface. labview keep calling the dll saving and feeding back the result of the model. Now the c++ is huge and it's not optimized or well commented. My problem is this a variable is set at the first call of the dll and then never set again but is used. So it' look like to me like the dll reserve a space in the memory and keep using it. Is this correct? I thought that the dll work similar to a function that is called reserve memory use it, then as soon as it is done is close and the memory is use if needed for something else.


I attached the labview part 

0 Kudos
Message 1 of 2

A DLL can keep values in memory between calls. For example if the DLL declares a global variable, that space will be allocated when the DLL first loads, and any function in the DLL can access it. It's also possible for a DLL function to allocate memory and dispose of it when the call ends; it depends on the code inside the DLL.

0 Kudos
Message 2 of 2