Results 1 to 19 of 19

Thread: .dll or .exe ??

  1. #1

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    .dll or .exe ??

    What is the most appropriate for a component that will be used by a set of ASPs to access a database?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  2. #2
    Addicted Member AngelinaM's Avatar
    Join Date
    Jan 2001
    Location
    Tampa, Florida
    Posts
    175

    Use a

    Dll, make sure you destroy it after you are finished using it.

    set object = nothing

  3. #3

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Hehe - had that problem yesterday. The .dll throws an error, doesn't get destroyed by the asp, and hence I can't bloody update it, because the OS says it's in use...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  4. #4
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    Perhaps it is a problem with you dll...do you have a memory leak?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  5. #5

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    No it's OK. Someone has solved this for me. The IIS still holds onto it in a cache or something, to reduce reload time apparently.

    I have to stop/start IIS through control panel to release it.


    Cheers,
    RJ


    P.S - Don't see much of you in the tech forums Simon.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  6. #6
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    hi,
    do u store your com object (dll) in Application or Session object?

  7. #7

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Application I guess - I just create and destroy it as needed.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  8. #8
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    what do u mean u 'guess'?
    when u craete object how u doing it?
    where u create the object? in global.asa or in specific page?

  9. #9

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I mean 'I guess' because I'm not fully aware of the difference...

    I create it on a specific page. I know it's not a Session object, so if there's only one other choice, I guess I must be using application objects.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  10. #10
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    hi,
    if u create your object per page it's fine.
    it means that u do not put it in Application or Session object.
    there r 2 possible ways to create object per page.
    the first is to add object tag in the page, and the second through Server.CreateObject function.
    the difference between the 2 is that in the first one, ASP create the object only when u make a call to the object explicitly. in the second case ASP create the object when he encounter the line with Server.CreateObject even if u do not making any use of that object at the next code.
    another thing is, never put an ActiveX DLL that created in VB in Application or Session object due to threading problem.

  11. #11

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    What's the threading problem? I have since starting this thread decided I want the object at Session level, as I want it to maintain some information for that scope.

    But as I have a .dll what problem will I encounter? I haven't had any that I'm aware of during testing?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  12. #12
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    hi again,
    this is a bit complex, do u want me to explain it?

  13. #13

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Yes please. I'm up to it.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  14. #14
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    every process running in the win32 system must have at least one thread of execution.
    the main thread act as an entry point to the process and is responsible for creating the main window (in case of user interface

    application) and set up a message loop to monitor incoming messages from the operating system.
    each process can have more than one thread, in this case it called multi thread application.
    in multithread application each thread have it's own stack. the schedular (part of the system responsible to control the threads in the

    system) allocate processing cycles by giving each thread a time slice.
    the problem in this manner is that u don't have control on the schedular that give time slice arbitrary. this mean that the schedular can
    take control off the thread in a middle of computing some values.
    this can lead to serious problems like inconsistency in data or even data corruption.
    For example, suppose we have an application with two threads. thread A calculate values and produce a new value to global variable

    called Sum. now at the middle of the computation, the system passes control to thread B which need the new value of Sum. but the

    value of Sum is incorrect because thread A didn't finish his work on that variable. this situation can lead (in the worse case) to crash

    the process.
    the problem with global data that accessed by multiple threads known as concurrency.
    in languages like c/c++, there r tools to handle with this situations. like semaphores, mutex and more.
    to avoid these problems with concurrency, it's possible to local varibles on the call stack for each thread. VB make heavy use of this

    TLS (thread locla storage) technique.
    as you can see, concurrency makes an application vulnerable to data inconsistency.

    the apertment model in COM is an abstraction concept, intended for concurrency problems.

    do u want me to continue?

  15. #15

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Ok yep, I understand all that. However, I'm still not clear on why having the .dll in a Session/App variable will be any more of a problem than if it's in a single page.

    And in any case, I don't think I'll have too much problem, the only global data being accessed by multiple instances of this .dll is a database, and they only read the data, so there shouldn't be any trouble there.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  16. #16
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    hi,
    i didn't finish yet, it was just a preface to understand the problem.
    i will write latter.

  17. #17

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    You got the rest of this one available yet?

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  18. #18
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    hi,
    i'm sorry, i totally forgor about it.
    look, right down is a link to understand what i have started, if u still have problems post me a message and i'll do my best to complete my explanation.
    http://codeguru.earthweb.com/activex...artments1.html

  19. #19

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Cheers.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width