From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
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.
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.