浏览代码

Fixes for Win32.

woollybah 8 年之前
父节点
当前提交
3787ddff0c
共有 2 个文件被更改,包括 11 次插入3 次删除
  1. 5 2
      stdc.mod/stdc.bmx
  2. 6 1
      stdc.mod/stdc.c

+ 5 - 2
stdc.mod/stdc.bmx

@@ -38,6 +38,9 @@ ModuleInfo "History: Fixed C Compiler warnings"
 
 ?linux
 ModuleInfo "CC_OPTS: -D_FILE_OFFSET_BITS=64"
+?win32
+Import "-lWs2_32"
+Import "inet_pton.c"
 ?
 
 Import "stdc.c"
@@ -103,7 +106,7 @@ Type TAddrInfo
 	
 	Method Delete()
 		If owner Then
-			freeaddrinfo(infoPtr)
+			freeaddrinfo_(infoPtr)
 		End If
 	End Method
 	
@@ -270,7 +273,7 @@ Function shutdown_:Int( socket:Int,how:Int )
 Function getsockname_:Int( socket:Int,addr:Byte Ptr,addr_len:Int Var )
 Function getpeername_:Int( socket:Int,addr:Byte Ptr,addr_len:Int Var )
 
-Function freeaddrinfo(res:Byte Ptr)
+Function freeaddrinfo_(res:Byte Ptr)
 Function bmx_stdc_addrinfo_flags:Int(info:Byte Ptr)
 Function bmx_stdc_addrinfo_family:Int(info:Byte Ptr)
 Function bmx_stdc_addrinfo_socktype:Int(info:Byte Ptr)

+ 6 - 1
stdc.mod/stdc.c

@@ -439,6 +439,10 @@ BBARRAY getaddrinfo_(BBString *name, BBString *service, int family) {
 
 }
 
+void freeaddrinfo_(struct addrinfo * info ) {
+	freeaddrinfo(info);
+}
+
 int connect_( int socket, struct addrinfo * info ){
 	return connect( socket, info->ai_addr, info->ai_addrlen);
 }
@@ -647,6 +651,7 @@ int inet_pton_(int family, BBString * src, void * dst) {
 	return res;
 }
 
+
 #if _WIN32
 
 static void CleanupWSA(){
@@ -661,7 +666,7 @@ int bb_stdc_Startup(){
 
 	WSADATA ws;
 	
-	WSAStartup( 0x101,&ws );
+	WSAStartup( MAKEWORD(2, 2),&ws );
 	atexit( CleanupWSA );
 
 #endif