CSocket::Create assertion in release mode - Programmer

This is a discussion on CSocket::Create assertion in release mode - Programmer ; Hi! I have a small app using CSocket which works file in debug mode. But strangely the connect() causes an assertion in release mode. It happens in AfxGetInstanceHandle(). Ignoring the assertion continues normally without any further problems. I don't understand ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: CSocket::Create assertion in release mode

  1. CSocket::Create assertion in release mode

    Hi!

    I have a small app using CSocket which works file in debug mode. But
    strangely the connect() causes an assertion in release mode. It
    happens in AfxGetInstanceHandle(). Ignoring the assertion continues
    normally without any further problems.

    I don't understand this assertion in release mode and not in debug? I
    do have AfxSocketInit() call in the InitInstance() of my CWinApp
    derived class.

    Any suggestions will be greaty appreciated.

    Thanks,
    Chan

  2. Re: CSocket::Create assertion in release mode

    Nanditha Chandra wrote:
    > Hi!
    >
    > I have a small app using CSocket which works file in debug mode. But
    > strangely the connect() causes an assertion in release mode. It
    > happens in AfxGetInstanceHandle(). Ignoring the assertion continues
    > normally without any further problems.
    >
    > I don't understand this assertion in release mode and not in debug? I
    > do have AfxSocketInit() call in the InitInstance() of my CWinApp
    > derived class.
    >
    > Any suggestions will be greaty appreciated.
    >
    > Thanks,
    > Chan


    Maybe you know this, but the MFC ASSERT statements disappear from a
    release build: They are meant for developers only. The fact that you
    have an assertion would seem to mean your build is bad: Including some
    debug libs, for example. You might be able to confirm this by using the
    Depends tools to find out which DLL versions you are linking to. The
    ones whose names end in 'D' are debug builds. If you mix release and
    debug modules in a build lots of things will go wrong.

    --
    Scott McPhillips [VC++ MVP]


  3. Re: CSocket::Create assertion in release mode

    Hi!
    That's what I thought. But it doesn't seem to be linking to any debug
    dlls. And besides I don't see the assertion in Debug mode. Is there
    anything else that could be causing an assertion in release mode?

    Also, I noticed that I don't have this problem if I change the project
    settings to use MFC as static lib instead of shared dll. But for a lot
    of other reasons, I have to used it as shared DLL itself. Does this
    give any clue as to what could be going wrong?

    Thanks,
    Chan



    "Scott McPhillips [MVP]" wrote in message news:...
    > Nanditha Chandra wrote:
    > > Hi!
    > >
    > > I have a small app using CSocket which works file in debug mode. But
    > > strangely the connect() causes an assertion in release mode. It
    > > happens in AfxGetInstanceHandle(). Ignoring the assertion continues
    > > normally without any further problems.
    > >
    > > I don't understand this assertion in release mode and not in debug? I
    > > do have AfxSocketInit() call in the InitInstance() of my CWinApp
    > > derived class.
    > >
    > > Any suggestions will be greaty appreciated.
    > >
    > > Thanks,
    > > Chan

    >
    > Maybe you know this, but the MFC ASSERT statements disappear from a
    > release build: They are meant for developers only. The fact that you
    > have an assertion would seem to mean your build is bad: Including some
    > debug libs, for example. You might be able to confirm this by using the
    > Depends tools to find out which DLL versions you are linking to. The
    > ones whose names end in 'D' are debug builds. If you mix release and
    > debug modules in a build lots of things will go wrong.


  4. Re: CSocket::Create assertion in release mode

    Nanditha Chandra wrote:
    > Hi!
    > That's what I thought. But it doesn't seem to be linking to any debug
    > dlls. And besides I don't see the assertion in Debug mode. Is there
    > anything else that could be causing an assertion in release mode?
    >
    > Also, I noticed that I don't have this problem if I change the project
    > settings to use MFC as static lib instead of shared dll. But for a lot
    > of other reasons, I have to used it as shared DLL itself. Does this
    > give any clue as to what could be going wrong?
    >
    > Thanks,
    > Chan


    No clue, but some random guesses from past problems: If you are using
    VC6 make sure you have installed service patch 5. If you have sockets
    in secondary threads call AfxSocketInit in each such thread. G' luck.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread