I’ve taken over quite a code base, and in teasing it apart as part of a re-factoring, I’ve managed to generate an error I don’t understand. What’s worse, I haven’t even touched the Rabbit libs (and apparently no one in my company has either, at least the ones affected here, tcp.lib and icmp.lib). Why in the world they should start failing is beyond me.
I’ve found a work-around by declaring a local version of struct typedef icmp_ip_t, but I would like to understand what the problem is. Please find the code below from tcp.lib, followed by the compiler errors when trying to use the typedef icmp_ip_t in icmp.lib.
The line 1813 refers to the function prototype, the actual function declaration doesn’t seem to affect the results.
Thanks in advance.
/*** BeginHeader _tcp_notify */
// typedef struct icmp_ip { // Here’s the one defined in icmp.lib.
// byte type; // Used as a template to create icmp_ip_t_local below.
// byte code;
// word checksum;
// longword ipaddr;
// in_Header ip;
// } icmp_ip_t;
typedef struct { // Here’s the local copy, without struct name.
byte type;
byte code;
word checksum;
longword ipaddr;
in_Header ip;
} icmp_ip_t_local;
typedef struct icmp_ip_local { // Here’s the local copy, with a struct name.
byte type;
byte code;
word checksum;
longword ipaddr;
in_Header ip;
} icmp_ip_t_local2;
//void _tcp_notify(icmp_ip_t * icmp, byte msg, ll_prefix __far * LL); // Doesn’t work.
//void _tcp_notify(icmp_ip_t_local * icmp, byte msg, ll_prefix __far * LL); // Works.
void _tcp_notify(icmp_ip_t_local2 * icmp, byte msg, ll_prefix __far * LL); // Works.
/*** EndHeader */
//_tcp_nodebug void _tcp_notify(icmp_ip_t * icmp, byte msg, ll_prefix __far * LL) // Doesn’t work.
//_tcp_nodebug void _tcp_notify(icmp_ip_t_local * icmp, byte msg, ll_prefix __far * LL) // Works.
_tcp_nodebug void _tcp_notify(icmp_ip_t_local2 * icmp, byte msg, ll_prefix __far * LL) // Works.
{
// This is upcalled from ICMP when we get a message relating to the TCP protocol.
auto in_Header * ip;
(etc…)
line 1813 : ERROR TCP.LIB : ‘,’ is missing/expected.
line 1813 : ERROR TCP.LIB : Syntax error - or garbage at end of program.
line 1813 : ERROR TCP.LIB : Need function definition or declaration.
line 1813 : ERROR TCP.LIB : Missing character ‘;’.
line 1813 : ERROR TCP.LIB : Type does not match declaration on line 172 of file C:\KAIROSRABBIT\DYNAMICC_10.72_LIBS\LIB\RABBIT4000\TCPIP\NET_DEFS.LIB.
line 1813 : ERROR TCP.LIB : Bad declaration: ‘,’ ‘;’ or ‘=’ expected.
line 1813 : ERROR TCP.LIB : Syntax error - or garbage at end of program.
line 1813 : ERROR TCP.LIB : Need function definition or declaration.
line 1813 : ERROR TCP.LIB : Expects ‘;’.
line 1813 : ERROR TCP.LIB : Old style function declaration missing parameter declaration list.
line 1813 : ERROR TCP.LIB : Missing character ‘)’.