Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with a Public variable in a DLL for the gurus
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Problem with a Public variable in a DLL for the gurus
Miscellaneous
Thread ID:
00706261
Message ID:
00706261
Views:
49
I need to have Public variable in a DLL method that calls other methods in other Classes which also access this variable.
However the problem with Public variables in a DLL is that their values are shared between threads when calls are made from ASP pages.
One solution is to create a General Class and Method that is used to call ALL other methods in other Classes. This General Method can hold a Private variable that is accessible by other Classes/Methods. Therefore if I want to call method M in Class C, in DLL D, I would issue the Call:
lo = CREATEOBJECT("D.General", "C","M")

In The Init Event on "D.General", I have the following code:
LPARAMETERS tcClass, tcMethod
PRIVATE pcMyVariable && Variable I want access to from all methods
pcMyVariable = THIS.GetMyVar()
loClass = CREATEOBJECT("C")
loClass.&M && Runs Method M in Class C
* I can now access pcMyVariable in method M.
* Note I cannot pass pcMyvariable as a parameter to method M as Method M is also called differently from other methods.

The solution above works, but does not sound right in an OOP environment. I would like some comments from the gurus.
Next
Reply
Map
View

Click here to load this message in the networking platform