Re: Compiling to a single exe file

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: adeel (anonymous_at_discussions.microsoft.com)
Date: 03/07/04


Date: Sun, 7 Mar 2004 22:06:28 +0500

Here's the code.......
[code]

UINT serverProc (LPVOID pParam)

{

CSocket hostSock;

// Creating the host socket and setting it up to listen for connection
attempts.

if (hostSock.Create(IVHOST_LISTENING_PORT) == TRUE) {

    if (hostSock.Listen(1) == TRUE) {

        while (true) {

        CSocket client;

        if (hostSock.Accept(client) == TRUE) {

            // Process client requests here.

            client.Receive (buffer, 512);

        }

        break;

        } // end of while

    }

return 0;

}

[/code]

There probably is nothing wrong with the code itself.... it works well when
MFC is being used as a shared dll. The access violation comes up only when I
use MFC as a statically linked library......

"adeel" <anonymous@discussions.microsoft.com> wrote in message
news:O%23u7s1%23AEHA.3184@TK2MSFTNGP09.phx.gbl...
> The error is a runtime access violation....... there's no time to call
> GetLastError. That is, the debugger sticks at the socket 'Create' call and
> refuses to step forward!
>
>
> "Jase" <jshelley@nospam.optushome.com.au> wrote in message
> news:404a8a09$0$3955$afc38c87@news.optusnet.com.au...
> > "adeel" <anonymous@discussions.microsoft.com> wrote in message
> > news:OUVmHY#AEHA.1212@TK2MSFTNGP12.phx.gbl...
> > > Thanks to both of you for replying.....
> > >
> > > If the static linking is the only way to do this........ then I guess
> I'm
> > > back to the issue I posted a few days ago (which was about getting
these
> > > runtime errors).
> > >
> > > I'm not making any cross-thread socket calls (have learned a good
leason
> > to
> > > avoid that!). The socket is created inside the thread that I want to
use
> > it
> > > in........ but the create call fails due to some unknown (to me)
reason.
> > >
> > > I wonder what I'm doing wrong :(
> > [snip]
> >
> > What does GetLastError() return? Your answers almost surely there.
> >
> > Jase
> >
> >
>
>