Results 1 to 11 of 11

Thread: Debugging DLLs

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67

    Debugging DLLs

    I'm working on a plugin system, and I'd like to be able to debug my plugin dll's as I work on them. Problem is, to use them they have to be compiled into actvex dlls, which are then referenced and loaded at runtime by the main program.

    Is there any way of pausing exection of the program to see what's going on inside the dll?

    Thanks,
    Az.

  2. #2
    Fanatic Member
    Join Date
    Feb 2003
    Location
    Los Angeles, CA
    Posts
    681
    you can open multiple projects in your vb6 gui inside a 'project group'. open the client exe, then File -> Add Project your dll server. you will have simultaneous debugging capabilities.
    there are 2 reasons why i leave my work unfinished:
    (1) i'm getting old.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    Yeah I know that, but because it's loading a built dll, which is having it's references added at runtime, it won't jump back into VB to debug it.

  4. #4
    Fanatic Member
    Join Date
    Feb 2003
    Location
    Los Angeles, CA
    Posts
    681
    ammm... nope. there may be no easy way to do the debugging in your case. sorry i took you for a beginner.
    there are 2 reasons why i leave my work unfinished:
    (1) i'm getting old.

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    How are you creating an instance of your plugin dll in your client?

    If you are using CreateObject then this code

    Dim objTemp As Object

    Set objTemp = CreateObject("Plugin.Testing")
    objTemp.ProcessIt

    Set objTemp = Nothing

    whether in a compiled app or a second instance of VB - will stop at any breakpoint and allow you to debug the Plugin dll, as long as it also is currently executing in VB. SOP.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    The problem is, the app is loading the dll by finding it on disk, rather than looking in the registry to find it, so the plugin has to be built as the dll for the main app to load it. This means that it can't be running in vb since it must be compiled and on disk.

    You may be right radum, there may be no way for me to debug them like this I might have to build an extra function in my main program to load a plugin that's not been built yet (ie still in the vb environment) just to debug them.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    The problem is, the app is loading the dll by finding it on disk, rather than looking in the registry to find it, so the plugin has to be built as the dll for the main app to load it. This means that it can't be running in vb since it must be compiled and on disk.
    So why don't you add an extra line of code which says "if this program is being run from VB, just load the DLL without searching for it"

    eg:
    VB Code:
    1. '...
    2. If RunningInVB Then
    3.   'use "createobject" to load the DLL
    4. Else
    5.   'search for the dll as you do already
    6. End If
    7. '...
    8.  
    9. Function RunningInVB() As Boolean
    10. 'Returns whether we are running in vb(true), or compiled (false)
    11.  
    12.     Static counter As Variant
    13.     If IsEmpty(counter) Then
    14.         counter = 1
    15.         Debug.Assert RunningInVB() Or True
    16.         counter = counter - 1
    17.     ElseIf counter = 1 Then
    18.         counter = 0
    19.     End If
    20.     RunningInVB = counter
    21.  
    22. End Function

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    That might help us to be able to write and debug our own plugins, since we can run the main app in vb, but for other people who want to write plugins for it, they'll be a bit stuck without our source code

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    well in that case, you could add a command line parameter for debugging, that specifies the name used for the "createobject" call.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    Originally posted by Azrael-TFX-
    You may be right radum, there may be no way for me to debug them like this I might have to build an extra function in my main program to load a plugin that's not been built yet (ie still in the vb environment) just to debug them.
    I already said that

    Thanks guys, think I'll try adding another function in the app

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    Cardiff, UK
    Posts
    67
    Ok, I've added another function, and the main exe finds and loads the plugin from the vb environment, but my problem now is I'm trying to pass an object into the plugin, and getting this error:

    Run-time error '98':

    A property or method call cannot include a reference to a private object, either as an argument or as a return value.


    What I'm trying to do works fine when I load a plugin from the dll, but it doesn't want to pass the object across from the exe to a plugin that's running in the vb environment. Is there any way to give my plugin access to this object?

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