Initialize Window sockets

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2000-10-11 18:49:32 +00:00
parent f74c84e5e9
commit 1e756dcab1
5 changed files with 31 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2000-10-11 Adam Fedor <fedor@gnu.org>
* Source/NSObject.m (+initialize): Initialize Window sockets
on MINGW.
* Source/libgnustep-base-entry.m (gnustep_base_socket_init):
New function.
2000-10-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSString.m: fillHole() fixed error in copying bytes.

View file

@ -95,7 +95,7 @@ mframe.m \
objc-gnu2next.m
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
GNU_MFILES += WindowsFileHandle.m
GNU_MFILES += WindowsFileHandle.m libgnustep-base-entry.m
else
GNU_MFILES += UnixFileHandle.m
endif

View file

@ -588,6 +588,13 @@ static BOOL double_release_check_enabled = NO;
if (self == [NSObject class])
{
extern void GSBuildStrings(); // See externs.m
#ifdef __MINGW__
// See libgnustep-base-entry.m
extern void gnustep_base_socket_init();
gnustep_base_socket_init();
#endif
#ifdef __FreeBSD__
// Manipulate the FPU to add the exception mask. (Fixes SIGFPE
// problems on *BSD)

View file

@ -42,6 +42,15 @@ int _MB_init_runtime()
}
#endif /* __MS_WIN32__ */
void
gnustep_base_socket_init()
{
/* Start of sockets so we can get host name and other info */
static WSADATA wsaData;
if (WSAStartup(MAKEWORD(2,0), &wsaData))
NSLog(@"Error: Could not startup Windows Sockets.\n");
}
LONG APIENTRY
gnustep_base_socket_handler(HWND hWnd, UINT message,
UINT wParam, LONG lParam);
@ -69,13 +78,10 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
/* Initialize the Microsoft C stdio DLL */
_CRT_INIT(hInst, ul_reason_for_call, lpReserved);
/* Initialize the GNUstep Base Library runtime structures */
gnustep_base_init_runtime();
#endif /* __MS_WIN32__ */
// Initialize Windows Sockets
if (WSAStartup(MAKEWORD(1,1), &lpWSAData))
NSLog(@"Error: Could not startup Windows Sockets.\n");
gnustep_base_socket_init();
// Register a window class for the socket handler
wc.lpszClassName = "GnustepBaseSocketHandler";
@ -178,3 +184,8 @@ gnustep_base_socket_handler(HWND hWnd, UINT message,
return 0;
}
/*
This section terminates the list of imports under GCC. If you do not
include this then you will have problems when linking with DLLs.
*/
asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0");

View file

@ -169,6 +169,7 @@ __objc_class_name_NSTimeZone
__objc_class_name_NSTimeZoneDetail
__objc_class_name_NSTimer
__objc_class_name_NSURL
__objc_class_name_GSFileURLHandle
__objc_class_name_NSURLHandle
__objc_class_name_NSUnarchiver
__objc_class_name_NSUnarchiverClassInfo