[futurebasic] Weird Global Behavior (TCP)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1998 : Group Archive : Group : All Groups

From: Brian Victor <bhv11@...>
Date: Sat, 30 May 1998 11:52:11 -0400
I'm doing some work with Greg's TCP files.  (Thanks, Greg!)  However, I've
been experiencing some persistent crashes that I finally traced down to the
global variable gDnrPtr&.  Simple tests with TEKEY$ indicate that gDnrPtr&
is 0, as it should be, immediately preceeding the call to
ConvertStringToAddr, and -1 immediately following it.  Because of the
nonzero value, it thinks it has a valid DNR code pointer, and doesn't
bother to find out what the real value is.  Certainly could be a cause of a
crash or two. ;)

I can't figure out why that variable is changing, though.  It's declared in
TCP-DNR.GLBL, which is included in a GLOBALS statement in both my main
program and TCP-DNR.INCL.  The COMPILE line is exactly the same in my main
file and the include file.  The code below is everything I have before the
local functions in my main program:


COMPILE 0,_dimmedVarsOnly_noRedimVars_macsBugLabels_caseInsensitive_STRresource

GLOBALS "BoardDraw.glbl"
GLOBALS "lineconsole.glbl"
GLOBALS "chessprefs.glbl"
GLOBALS "menus.glbl"
GLOBALS "TCP-DNR.GLBL"
GLOBALS "myTCP.glbl"
REM input is coming from server, output is going to server
DIM gInputBuffer$,gOutputBuffer$
'DIM gTCPHostName$,gTCPport,gTimeOutTicks&,gConnected
END GLOBALS

INCLUDE "BoardDraw.incl"
INCLUDE "lineconsole.incl"
INCLUDE "chessprefs.incl"
INCLUDE "TCP-DNR.INCL"
GOTO "foo"

"foo" is a label just after the local functions.  Removing that goto has no
effect.

The call in question is: err = FN ConvertStringToAddr(gTCPHostName$,@gTCPcon)

The last line before that call and the first line in the function I
displayed gDnrPtr&, and it had indeed changed.  If anyone has any clue as
to why this is happening, please clue me in. :)

Thanks in advance.

-- Brian Victor

PS. I'm using Greg's code almost unmodified, except for the removal of the
SMTP stuff in the main code and the addition of my own code.