Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with a Public variable in a DLL for the gurus
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00706261
Message ID:
00706268
Vues:
20
Hi!

What about a temporary table shared by all DLL instances? Do you access this variable very often? If not, this solution probably a ood one.

Also, when you use COM+, there is a special object to share data between COM+ object instances.

>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.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform