2

My application consists of a VB6 DLL that is called from ASP. It needs to manage a pool of connections to a (non-standard) database. I implemented this by using a global variable, but this is being reset every 20 minutes due to an ASP setting causing the application to crash.

A previous poster said that DLLs in ASP are all created in their own address space, thus making global variable solutions completely unworkable, as each page access would have its own ‘globals’.

That doesn’t fit with my observation that globals seem to exist until the DLL reaches its idle timeout.

Which of us is right? What scope can I assume on DLL globals?

1
  • 1
    Not seeing where anyone said that "DLLS in ASP are all created in their own address space"? Which of course doesn't make any sense, its the process that owns the address space, a dll can't create an address space. Jan 2, 2010 at 21:41

1 Answer 1

1

The idea that each request would get its own copy of the global variables is False.

However it is strongly recommended that you compile VB6 dlls for use in asp as apartment threaded and with the retain in memory setting.

Each thread will get its own copy of the global variables. Hence multiple requests will not necessarily see the same global variables if those requests are run on different threads.

In observing IIS6 I noticed that in test situations where there is rarely multiple request running at the same time the same thread gets used for subsequent requests. I suspect that this may be the reason it appears to you that you have a single set of global variables. In production this is not going to be true.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.