Mulitple instances of a DLL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Nunnally
    New Member
    • Jul 2007
    • 56

    #1

    Mulitple instances of a DLL

    I wrote a DLL in .NET. I have a public function that controls access to another public function. For instance, once function #1 is called, function #2 has to return false until function #1 is finished. For this, I set just set a flag, turn it on when function 1 is started, and off when finished.

    What would happen if someone using this DLL had instantiated one instance of this DLL to call function #1, and another to call function #2. That flag would not be set correctly in #2 right? How could I control this? What is the best practice?
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    Do something in your DLL that stops multiple instances being created... or if it's a case of multiple instances of a class within your DLL, then use a singleton pattern to prevent multiple instances of the object.

    It really depends on the structure of your app as to how this would be most easily achievable.

    Comment

    • Ramk
      New Member
      • Nov 2008
      • 61

      #3
      Originally posted by balabaster
      Do something in your DLL that stops multiple instances being created... or if it's a case of multiple instances of a class within your DLL, then use a singleton pattern to prevent multiple instances of the object.

      It really depends on the structure of your app as to how this would be most easily achievable.
      Have a look at Process class provided by .net frmwork.

      Comment

      Working...