SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast Grubilo's Avatar
    Join Date
    Oct 2002
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with COM DLL in ASP

    Hello gurus !

    When I use any COM object like this:

    Set a=Server.CreateObject("ComObjectName")
    a.DoSomething(b)
    response.write b

    Set a=nothing
    ...

    I can't then do anything with the DLL file for this COM object. Looks like it is blocked and can't be released.

    Would you please point me on the possible error line in the code above or what function should I use to unlock the library file.
    Thank you in advance !
    Web tutorials
    http://webclass.ru

  2. #2
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is DoSomething a function or a sub? a sub won't return anything. plus, i would probably write it this way:

    Code:
    response.write (a.DoSomething(b))
    or like:

    Code:
    newvar = a.DoSomething(b)
    response.write newvar
    i don't believe that your line "response.write b" actually would do anything except write out what the value of "b" is, not what it would become after passing it to the com.

    HTH

  3. #3
    SitePoint Enthusiast Grubilo's Avatar
    Join Date
    Oct 2002
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, let me correct my question.

    After I do the following:

    Set a=Server.CreateObject("something");
    a=nothing

    when the page executes I can't delete/remove/rebuild the DLL file containing this COM object... !!!

    I tried to restart IIS but it did not help.
    The only way to free this DLL is to restart my computer.
    By the way I have Win2000 Server.

    Hope you guys will help me!
    Web tutorials
    http://webclass.ru

  4. #4
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think i know what you're going through. had some of the same problems when testing a recent com of mine. you can, in a pinch, open up task manager (cntrl-alt-delete, select task man) and then go into processes, select your process and click "end process" button. but too much of that isn't good for your machine.

    what i did that worked better for me was to build a test application (i was working in VB 6) that i ran to test my com. once i had it working error free, then i used it on the web side. it's pretty easy to debug the com this way.

    don't know if this applies in your situation though, as i don't know enough about the dll your using/building...

  5. #5
    SitePoint Enthusiast Grubilo's Avatar
    Join Date
    Oct 2002
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very close !
    I found the typical scheme for reinstalling DLL of the COM objects.
    After you use it in ASP you should unregister the dll with regsvr32.exe -u ... and then restart IIS web service.

    After that you can manually delete/relpace that DLL file.
    Web tutorials
    http://webclass.ru

  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I hate to be a pain and correct you, but there's a few things that I thought I'd point out...

    Quote Originally Posted by bbolte
    is DoSomething a function or a sub? a sub won't return anything. plus, i would probably write it this way:

    Code:
    response.write (a.DoSomething(b))
    That extra set of brackets is completely unnecessary, and will actually require the script engine to do (infinitesimally) more work, so unless it's simply to make your code look prettier (which personally I don't think it does, but each to their own), I suggest that this should NOT be adopted as a coding style.

    Quote Originally Posted by bbolte
    i don't believe that your line "response.write b" actually would do anything except write out what the value of "b" is, not what it would become after passing it to the com.

    HTH
    Since b is passed as a parameter, there's no reason why the sub can't be taking it as a ByRef rather than ByVal and modifying it directly, in which case response.writing it would indeed show the new value.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  7. #7
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for that, hadn't considered the byref/val thing.

  8. #8
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wait, now i have a question. even between a dll and an asp page, "b" could be modified?

  9. #9
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't see why not, but not having written a COM component myself there may be limitations I'm not aware of - i.e. perhaps only objects can be passed ByRef to a COM sub/function. Even so, that would still be a valid example of what I have suggested.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  10. #10
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i found something that might help

    Quote Originally Posted by Grubilo
    Very close !
    I found the typical scheme for reinstalling DLL of the COM objects.
    After you use it in ASP you should unregister the dll with regsvr32.exe -u ... and then restart IIS web service.

    After that you can manually delete/relpace that DLL file.
    found this article: http://www.iisfaq.com/default.aspx?View=A299, see if that is what you're looking for.


Bookmarks

Posting Permissions

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