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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Modules in DLLs

Status
Not open for further replies.

VB400

Programmer
Sep 8, 1999
359
US

I posted this question in the "Visual Basic (Microsoft) Using Modules and Classes" forum (I thought it would be the best place for it) but that forum doesn't have nearly as many members as this one. So I'm hoping I'll get some response here.


I have an ActiveX DLL running inside MTS on an application server. There are about 20 class modules in the dll that are instantiated by the client using:

Set mobjXYZ = CreateObject("DLLName.ClassName", MyServer)

It is clear that we can have one object instantiated by 15 different clients almost simultaneously and each will have their own "copy" of object (e.g. if I ask for employee #1 and you ask for employee #2 at the same time, there is no collision between our requests). The two instances may even be created in two separate threads.

What if the object we're creating uses some code in a Basic Module! There is no instantiation of an object when calling subroutines in a code module -- is there a possibility of a collision?

For example, let's say that there is an object that two users instantiate simultaneously, we now have two instances of the object running. These objects call a long running subroutine in a code module. Will the first instance cause the second one to wait until it is done or will it allow the second instance to get started? If the common subroutine accepts a parameter, if while the first instance is running and using the input parameter, the second instance calls the same subroutine with a different parameter value, will that effect the first instance?

I guess another way to put this is: When calling a subroutine in a Basic Module within a multiuser environment, does the subroutine run in each caller's space (in a sense making a copy of itself) or does it run in its own space?

I hope you can understand what I'm trying to say here!

Thanks in advance!
[sig]<p> Tarek<br><a href= > </a><br>The more I learn, the more I need to learn![/sig]
 
VB400,

Let me preface all that follows with the giant disclaimer. [red]I think ... [red]

Each call will generate a new instantiation of the objects it references - this will include any code - at the module level. This means there will be no &quot;collision&quot;, &quot;blocking&quot; or &quot;interference&quot; between the seperate users.

This 'follows' the multiuser model for most MS language products. Think about the Multiuser Ms. Access database. Even when the app is run from a server, each user may 'do' anything with interferance with other users, with the well publicized exception of simultaneous updating of records (more precisely, record in the same BLOCK).

Having 'run' such a database with up to 200 users, I can assure you that the only problem in several incarnations of the database (Ms. Access '97 and '97 both with &quot;integrated&quot; data and form/reports ... and with the &quot;split&quot; data base tables seperate from all else and with the tables and queries in the &quot;Master DB&quot; and forms, reports and modules in the front end. Also, with the &quot;front end compiled (MDE) and back end as MDB. In no instance (with the &quot;correct form, report, and modules) did I have any difficulty with 'collisions'.

I am sure ther are some holes in the overall scheme Ms. is using, however all of the problems I encountered were the result of human error (mostly mine?) in the design and implementation of the system - not a multi-user issue.


[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 

Thanks Michael,

This is my gut feeling as well, coming from Midrange Systems development. I just wanted to be sure before coding begins.

I'm still a bit unsure because of your disclaimer! [sig]<p> Tarek<br><a href= > </a><br>The more I learn, the more I need to learn![/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top