Problem cross compiling after adding tests for inet_ntop

Jeff Latimer lats at yless4u.com.au
Fri Feb 20 17:57:31 CST 2009


I have been writing some tests for InetNtop/inet_ntop and placed them in 
dlls/ws2_32/tests/sock.c (snip of the code is below) but when I cross 
compile I get:

make crosstest
i386-mingw32-gcc -c -I. -I. -I../../../include -I../../../include    -g 
-O2 -o sock.cross.o sock.c
i386-mingw32-gcc protocol.cross.o sock.cross.o     testlist.cross.o -o 
ws2_32_crosstest.exe -L../../../dlls ../../../libs/port/libwine_port.a 
-L../../../dlls/ws2_32 -L../../../dlls/kernel32 -lws2_32 -lkernel32  
sock.cross.o: In function `test_inet_addr':
/wing/dlls/ws2_32/tests/sock.c:2013: undefined reference to `_inet_ntop at 16'
/wing/dlls/ws2_32/tests/sock.c:2025: undefined reference to `_inet_ntop at 16'
/wing/dlls/ws2_32/tests/sock.c:2029: undefined reference to `_inet_ntop at 16'
/wing/dlls/ws2_32/tests/sock.c:2032: undefined reference to `_inet_ntop at 16'
collect2: ld returned 1 exit status
make: *** [ws2_32_crosstest.exe] Error 1

I am using unmodified winsock.spec and ws2_32.spec files.  It does not 
look like inet_ntop has been used in tests previously.  Any ideas on 
what I need to do to get crosstest  to work?
----

dlls/ws2_32/tests/sock.c

static void test_inet_addr(void)
{
    u_long addr;
    char dst[16];
    char dst6[64];
    u_char ip6_addr[16] = {0x20,0x30,0xa4,0xb1};
    const char * pdst;
    struct in_addr in;
    struct in6_addr in6;
    u_long addr0_Num = 0x00000000;
    PCSTR addr0_Str = "0.0.0.0";
    u_long addr1_Num = 0x20201015;
    PCSTR addr1_Str = "21.16.32.32";
    u_char addr2_Num[16] = 
{0,0,0,0,0,0,0,0,0,0,0xff,0xfe,0xcC,0x98,0xbd,0x74};
    PCSTR addr2_Str = "::fffe:cc98:bd74";

    addr = inet_addr(NULL);
    in.S_un.S_addr = addr;
    trace("addr=%ld\n",addr);
    ok(addr == INADDR_NONE, "inet_addr succeeded unexpectedly\n");
    in.S_un.S_addr = addr0_Num;
    pdst = InetNtop(AF_INET,(void*)&in.S_un.S_addr,dst,sizeof(dst));
    ok(strcmp(pdst, addr1_Str),"Address %s != %s\n", pdst, addr0_Str);
    ok(pdst != NULL, "InetNtop failed %s\n", dst);
    pdst = inet_ntoa(*((struct in_addr*)&in.s_addr));
    ok(pdst != NULL, "InetNtop succeeded unexpectedly %s\n", dst);
    ok(!strcmp(pdst, addr1_Str),"Address %s != %s\n", pdst, addr0_Str);
    trace ("addr=%s\n",pdst);
    in.S_un.S_addr = addr1_Num;
    pdst = inet_ntoa(*((struct in_addr*)&in.s_addr));
    ok(pdst != NULL, "inet_ntoa succeeded unexpectedly %s\n", dst);
    ok(!strcmp(pdst, addr1_Str),"Address %s != %s\n", pdst, addr1_Str);
    trace ("addr=%s\n",pdst);
    pdst = InetNtop(AF_INET6,(void*)&in.S_un.S_addr,dst,sizeof(dst));
    trace ("addr=%s\n",pdst);
    ok(pdst != NULL, "InetNtop failed %s\n", dst);
    memcpy(in6.s6_addr,ip6_addr,sizeof(ip6_addr));
    pdst = InetNtop(AF_INET6,(void*)&in6.s6_addr,dst6,sizeof(dst6));
    ok(pdst != NULL, "InetNtop failed %s\n", dst6);
    memcpy(in6.u.Byte,addr2_Num,sizeof(addr2_Num));
    pdst = InetNtop(AF_INET6,(void*)&in6.s6_addr,dst6,sizeof(dst6));
    ok(pdst != NULL, "InetNtop failed %s\n", dst6);
    ok(!strcmp(pdst, addr2_Str),"Address %s != %s\n", pdst, addr2_Str);
}






More information about the wine-devel mailing list