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. C / C++ / MFC
  4. Rebuild VC++ Debug Library ?

Rebuild VC++ Debug Library ?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcomdebuggingquestion
6 Posts 3 Posters 1 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.
  • W Offline
    W Offline
    Will Beattie
    wrote on last edited by
    #1

    Hi all, I have a problem with an acknowledged MSDN Bug - being... using sockets in a multithread program. SP5 supposedly fixed the bug (?) but I still get asserts when using either version of the VC++ Debug libraries. Is there new Debug libraries available or can I just modify the sockcore.cpp file and rebuild it ? cheers Will Beattie whybotha69@hotmail.com

    R 1 Reply Last reply
    0
    • W Will Beattie

      Hi all, I have a problem with an acknowledged MSDN Bug - being... using sockets in a multithread program. SP5 supposedly fixed the bug (?) but I still get asserts when using either version of the VC++ Debug libraries. Is there new Debug libraries available or can I just modify the sockcore.cpp file and rebuild it ? cheers Will Beattie whybotha69@hotmail.com

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      You can rebuild the MFC source files (there is info in MSDN on how to do this properly), but it might be easier to try to work around the bug. Did the KB article give information on how to work around the bug? Just a tip. If you do rebuild the source files, don't put the new version in your Windows/System folder - other programs may break because of the fix. The same goes for the Release version if you rebuild that as well. If you have to distribute a modified version of the MFC library, store it in the same folder as your program. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      W 1 Reply Last reply
      0
      • R Ryan Binns

        You can rebuild the MFC source files (there is info in MSDN on how to do this properly), but it might be easier to try to work around the bug. Did the KB article give information on how to work around the bug? Just a tip. If you do rebuild the source files, don't put the new version in your Windows/System folder - other programs may break because of the fix. The same goes for the Release version if you rebuild that as well. If you have to distribute a modified version of the MFC library, store it in the same folder as your program. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
        Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

        W Offline
        W Offline
        Will Beattie
        wrote on last edited by
        #3

        Thanks Ryan, I have done heap of hunting on this problem which basically boiled down to creating a Socket in one thread and then trying to use it in another thread. MFC does not allow sockets to be passed between threads or so it appears. I don't know if this is a bug as suggested by their bug fix "Q193101" "SYMPTOMS When using MFC sockets in secondary threads in a statically linked MFC Visual C++ 6.0 application, an unhandled exception occurs. CAUSE The reason for the unhandled exception is that an object of type CMapPtrToPtr pointer, pointed to by m_pmapSocketHandle, is never created." I will keep trying. cheers Will Beattie

        R B 2 Replies Last reply
        0
        • W Will Beattie

          Thanks Ryan, I have done heap of hunting on this problem which basically boiled down to creating a Socket in one thread and then trying to use it in another thread. MFC does not allow sockets to be passed between threads or so it appears. I don't know if this is a bug as suggested by their bug fix "Q193101" "SYMPTOMS When using MFC sockets in secondary threads in a statically linked MFC Visual C++ 6.0 application, an unhandled exception occurs. CAUSE The reason for the unhandled exception is that an object of type CMapPtrToPtr pointer, pointed to by m_pmapSocketHandle, is never created." I will keep trying. cheers Will Beattie

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          whybotha69 wrote: MFC does not allow sockets to be passed between threads or so it appears. I don't know if this is a bug as suggested by their bug fix "Q193101" No other MFC object that relies on a Windows HANDLE can be passed between threads, so I assume sockets are the same, ie. I believe this is the correct behaviour, not a bug. The KB article only shows how to prevent the unhandled exception error that occurs. It doesn't say that sockets can be used in multiple threads. I'm certain that a MFC socket can only be used in one thread. Did you try their solution to prevent the error? Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
          Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

          W 1 Reply Last reply
          0
          • R Ryan Binns

            whybotha69 wrote: MFC does not allow sockets to be passed between threads or so it appears. I don't know if this is a bug as suggested by their bug fix "Q193101" No other MFC object that relies on a Windows HANDLE can be passed between threads, so I assume sockets are the same, ie. I believe this is the correct behaviour, not a bug. The KB article only shows how to prevent the unhandled exception error that occurs. It doesn't say that sockets can be used in multiple threads. I'm certain that a MFC socket can only be used in one thread. Did you try their solution to prevent the error? Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
            Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

            W Offline
            W Offline
            Will Beattie
            wrote on last edited by
            #5

            Hi Ryan, Yes I tried their fix .. no luck. My code works as required in Release but Asserts when in Debug mode. As to MFC Sockets and multithreading the jury is undecided. This article has a section near the bottom called "CSocket Objects and Multithreading". http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarpic/html/msdn\_wsockets.asp Thanks Will

            1 Reply Last reply
            0
            • W Will Beattie

              Thanks Ryan, I have done heap of hunting on this problem which basically boiled down to creating a Socket in one thread and then trying to use it in another thread. MFC does not allow sockets to be passed between threads or so it appears. I don't know if this is a bug as suggested by their bug fix "Q193101" "SYMPTOMS When using MFC sockets in secondary threads in a statically linked MFC Visual C++ 6.0 application, an unhandled exception occurs. CAUSE The reason for the unhandled exception is that an object of type CMapPtrToPtr pointer, pointed to by m_pmapSocketHandle, is never created." I will keep trying. cheers Will Beattie

              B Offline
              B Offline
              Baris Kurtlutepe
              wrote on last edited by
              #6

              whybotha69 wrote: creating a Socket in one thread and then trying to use it in another thread. Hi, I hope you know that in order to use the MFC's socket object between two threads you should do a Detach() on the object which will give you a handle of type SOCKET, and then Attach() using that handle in the other thread. Which is basically: - Call Detach() on the object in order to obtain the SOCKET handle - Delete the detached object - Create the (CSocket or CAsyncSocket) object in the second thread - Attach the SOCKET handle to the newly created object using Attach() The bug mentioned in Q193101 is not about this exactly, it's about creating and using sockets objects in secondary threads.

              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