Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. how to debug visual com dll ??

how to debug visual com dll ??

Scheduled Pinned Locked Moved COM
helpc++questioncomdebugging
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leesen
    wrote on last edited by
    #1

    hi,all I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with the c++ pointer ??? But how can I find the actuall false?? Are there any tools to help to debug the com dll?? The problem disturb me for very long time . Ask for your help , please ! Regards.

    G 1 Reply Last reply
    0
    • L Leesen

      hi,all I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with the c++ pointer ??? But how can I find the actuall false?? Are there any tools to help to debug the com dll?? The problem disturb me for very long time . Ask for your help , please ! Regards.

      G Offline
      G Offline
      geo_m
      wrote on last edited by
      #2

      Best way is to load the ATL project to the MSVC and set up the visual basic as a startup exe. Then when you press f5, the VB will be started. You can work with the VB as you want, e.g. load some test project, but you can put the breakpoints to methods of your DLL and the execution will stop there in case it will be called...

      L 1 Reply Last reply
      0
      • G geo_m

        Best way is to load the ATL project to the MSVC and set up the visual basic as a startup exe. Then when you press f5, the VB will be started. You can work with the VB as you want, e.g. load some test project, but you can put the breakpoints to methods of your DLL and the execution will stop there in case it will be called...

        L Offline
        L Offline
        Leesen
        wrote on last edited by
        #3

        hi, thx. I can debug the com dll following your advice. Because just when my vb program exit the errors occurrs, I set breakpoints in destructor function . Then when I exit the vb program ,it seemed the program did not execute the destructor code. It did not pause on the breakpoints,instead there showed a error dialog "Unhandled exception in P2P.exe : Access Violation". If I direct run the vb program without the debug mode , when I exit the vb program I will receive such error message"the memory address can't be read..." why?? I am exhausting now after so much try. thx. regards.

        G 1 Reply Last reply
        0
        • L Leesen

          hi, thx. I can debug the com dll following your advice. Because just when my vb program exit the errors occurrs, I set breakpoints in destructor function . Then when I exit the vb program ,it seemed the program did not execute the destructor code. It did not pause on the breakpoints,instead there showed a error dialog "Unhandled exception in P2P.exe : Access Violation". If I direct run the vb program without the debug mode , when I exit the vb program I will receive such error message"the memory address can't be read..." why?? I am exhausting now after so much try. thx. regards.

          G Offline
          G Offline
          geo_m
          wrote on last edited by
          #4

          Hi, well have not exactly an idea, only what I would check very carefully are the circular references in VB. I think, that the similar things happened to me some time ago, when I 'developed' a circular reference through three objects and the VB garbage collector didn't detect it and failed on some exception. What can be next thing is some topics similar to it - returning a pointer to memory which is later freed inside the component (normally one should return a copy of the memory, because VB will release it later) and similar thingiez. In short, first who will be suspect for me in such a case will be the VB garbagge colector.

          L 1 Reply Last reply
          0
          • G geo_m

            Hi, well have not exactly an idea, only what I would check very carefully are the circular references in VB. I think, that the similar things happened to me some time ago, when I 'developed' a circular reference through three objects and the VB garbage collector didn't detect it and failed on some exception. What can be next thing is some topics similar to it - returning a pointer to memory which is later freed inside the component (normally one should return a copy of the memory, because VB will release it later) and similar thingiez. In short, first who will be suspect for me in such a case will be the VB garbagge colector.

            L Offline
            L Offline
            Leesen
            wrote on last edited by
            #5

            hi But how can I solve this problem . You know ,anyway ,if the program have such a bug ,my boss will not be satisfactory with me. I have try many times these days, but failed. Can you give me some advice on how to resolve this problem. It'll be appreciated. thx. regards.

            G 1 Reply Last reply
            0
            • L Leesen

              hi But how can I solve this problem . You know ,anyway ,if the program have such a bug ,my boss will not be satisfactory with me. I have try many times these days, but failed. Can you give me some advice on how to resolve this problem. It'll be appreciated. thx. regards.

              G Offline
              G Offline
              geo_m
              wrote on last edited by
              #6

              Yeah. Bosses are allways the same. Anyway, this is very difficult question. It depends on the program design. Normally I am checking nearly everything regarding all return values especially returning some memory structures (BSTR, VARIANTS, arrays...). Also I am checking the dependencies and ownerships you can sometimes see, that object A points to object B and object B points to object C while C points to A - this is exactly the situation where VB garbagge collector crashes. Good luck!

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups