I have a process which calls a DLL several times. In the DLL, I have some variables which have to be initialized from a XML file and their values will remain same. Just as an example, let's say my process is following:
- Ask user to enter the
Name
- Ask user to enter the
Employee ID
- Call DLL and read the values of
Company Name
,Street
,City
andZIP Code
from a XML file - Generate a report.
- Repeat from step-1 (loop)
QUESTION: As the values of the Company Name
, Street
, City
and ZIP Code
defined in XML file will remain same so, there is no point of reading the XML file for every call to this DLL in this looped process. How can I set the variable in DLL during first call and use them for rest of the calls?
UPDATE: As some answers has suggested to use global variables and initialize them once after reading from XML file but unfortunately, it is not possible in my process. It is because of the reason that only the DLL is in the C++ and rest of the process is using an another framework. Though, I can extract the values from DLL and assign to the variables of another framework but this DLL is a part of big project and I am not allowed to modify the variables and another stuff of the main project. That's why I have to find a way that this DLL maintains its own copy of variables.