allbery@ncoast.UUCP (Brandon S. Allbery) (07/26/86)
I've been working on a communications program for MS-DOS. Today I got the thing working from Turbo, successfully logging in and sending and receiving packets. Then I compiled it to a .COM file and tried it -- and it got a garbage packet ID. I tried various changes -- no soap. Then I put in some debugging lines and learned that the packet ID was in fact correct within the RCVPACKET function, but bad on return; further experimentation showed that the number was never sent to the main program. Internals: The declaration of RCVPACKET is: FUNCTION RCVPACKET(PORT : PORTTYPE; VAR ID : INTEGER; BUFFER : CHARPTR) : INTEGER; ID is the received packet ID. Some experimentation showed that as long as Turbo Pascal compiled the program in memory, ID was in fact a VAR parameter; but when compiled to a .COM file, ID was treated as a value parameter and RCVID's value in the main program (RCVPACKET(COM2, RCVID, ADDR(RCVBUF));) was never changed. (I am using a workaround at present: I'm storing ID in a global variable and retrieving its value after the call to RCVPACKET. The program works fine and I have begun assembling a protocol.) It only happens with the RCVPACKET function called from the main block; a procedure I call within the packet code using VAR parameters works fine. It may have to do with the fact that the internal variable RCVID has the same name as the main block variable receiving the ID, although that seems unlikely. Does anyone know of this bug? Any fixes? ++Brandon -- ---------------- /--/ Brandon S. Allbery UUCP: / / /|\/ Tridelta Industries, Inc. decvax!cwruecmp!ncoast! ---- -------- /-++ 7350 Corporate Blvd. tdi2!brandon / / /---, /--/ Mentor, Ohio 44060 PHONE: (home) / / / / / / -- HOME -- +1 216 974 9210 / / / / / / 6615 Center St. Apt. A1-105 ARPA: ncoast!allbery% ---- /----~ /--/ Mentor, Ohio 44060-4101 case.CSNET@csnet-relay ------------------------------------------------------------------------------- Space -- The Final Frontier