Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Life Time in DLL

Status
Not open for further replies.

NeilV

Programmer
Oct 14, 2002
117
GB
I have created a DLL but I am having problems with storing values in a global variable. I want to do the following:

1. Execute Function
2. If global variable is certain value then do something and assign new value to global variable.
3. exit function and save value of global variable

It works fine in a normal project but in the dll the value of the global variable only exists while the function is running, after that the global variable seems to get destroyed!

HELP!(please)

Neil [bigears]
 
A global variable should work for you. Where did you define the variable? What is the line of code for the declaration?
 
If you create an instance of the dll function, and then destroy it in your main program, any values being used in that instance are also destroyed. Otherwise the global should be good until the object is destroyed.
 
I have now fixed the problem. Didn't change a thing but it seems to work ok!how odd!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top