]> gcc.gnu.org Git - gcc.git/blob - libjava/win32.cc
prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.
[gcc.git] / libjava / win32.cc
1 // win32.cc - Helper functions for Microsoft-flavored OSs.
2
3 /* Copyright (C) 2002 Free Software Foundation
4
5 This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
10
11 #include <config.h>
12
13 #include "platform.h"
14
15 static LONG CALLBACK
16 win32_exception_handler (LPEXCEPTION_POINTERS e)
17 {
18 if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
19 _Jv_ThrowNullPointerException();
20 else if (e->ExceptionRecord->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
21 throw new java::lang::ArithmeticException;
22 else
23 return EXCEPTION_CONTINUE_SEARCH;
24 }
25
26 // Platform-specific VM initialization.
27 void
28 _Jv_platform_initialize (void)
29 {
30 // Initialise winsock for networking
31 WSADATA data;
32 if (WSAStartup (MAKEWORD (1, 1), &data))
33 MessageBox (NULL, "Error initialising winsock library.", "Error",
34 MB_OK | MB_ICONEXCLAMATION);
35 // Install exception handler
36 SetUnhandledExceptionFilter (win32_exception_handler);
37 }
This page took 0.045365 seconds and 6 git commands to generate.