john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

gcc winsock

/*john pfeiffer 05oct07 gcc working command line winsock
gcc -o test.exe test.c -lws2_32 -lwsock32 -Iinclude -Llib   (include and lib folders for orphan gcc.exe)    */

#include <stdio.h>
#include <winsock.h>

int main()
{
    struct WSAData ws;
    int d;
    printf("test\n");
    d = WSAStartup( 0x0202, &ws );
    printf("test %d",d);
    WSACleanup();
    return 0;
}

/* as.exe, cc1.exe, cpp.exe, cr2.o, gcc.exe, ld.exe

/include has _mingw.h, basetyps.h, cderr.h, commdlg.h, dde.h,
    ddeml.h, dlgs.h, ecpt.h, lzexpand.h, nb30.h, rpc.h, 
    rpcdce.h, rpcdcep.h, rpcnsi.h, rpcnterr.h, shellapi.h,
    starg.h, stddef.h, stdio.h, string.h, winbase.h,
    wincon.h, windef.h, windows.h, winerror.h, windgi.h,
    winnetwk.h, winnls.h, winnt.h, winperf.h, winsock.h,
    winspool.h, winsvc.h, winuser.h, winver.h
    winreg.h
maybe sys/types.h

/lib has libadvapi32.a, libgcc.a, libkernel32.a, libmingw32.a, 
    libmoldname.a, libmsvcrt.a, libshell32.a libuser32.a, 
    libws2_32.a, libwsock32.a
and of course this .c source file...
*/

  • « pass program safe parameters
  • breakloop »

Published

Oct 7, 2007

Category

c

~108 words

Tags

  • c 95
  • gcc 9
  • winsock 1