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 ActiveX DLLs

Status
Not open for further replies.

VB400

Programmer
Sep 8, 1999
359
US

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]
 
As a general rule I only ever store constants in a Bas file within a multiuser object.
The reason for this is that I developed a system for 5500 users it had one bas file with some generic functionality and it kept falling over until I removed the bas file


hope this helps

[sig][/sig]
 

Vince,

Did you ever find out why it (the code module) was causing a problem?

Since I posted the question, I found that other programmers use code modules without a problem and their understanding is that when an instance of an object calls a subroutine in a code module, that subroutine runs under the &quot;umbrella&quot; of the object instance. Thus if more than one instance is calling the same subroutine, a different &quot;copy&quot; of the subroutine is actually running.

Now what do I do?
[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