diff options
Diffstat (limited to 'ocaml-binary-annot/otherlibs/win32unix/startup.c')
| -rw-r--r-- | ocaml-binary-annot/otherlibs/win32unix/startup.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ocaml-binary-annot/otherlibs/win32unix/startup.c b/ocaml-binary-annot/otherlibs/win32unix/startup.c new file mode 100644 index 0000000000..8417e13669 --- /dev/null +++ b/ocaml-binary-annot/otherlibs/win32unix/startup.c @@ -0,0 +1,50 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy and Pascal Cuoq, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU Library General Public License, with */ +/* the special exception on linking described in file ../../LICENSE. */ +/* */ +/***********************************************************************/ + +#include <stdio.h> +#include <fcntl.h> +#include <stdlib.h> +#include <mlvalues.h> +#include "unixsupport.h" +#include "winworker.h" +#include "windbug.h" + +value val_process_id; + +CAMLprim value win_startup(unit) + value unit; +{ + WSADATA wsaData; + int i; + HANDLE h; + + (void) WSAStartup(MAKEWORD(2, 0), &wsaData); + DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), + GetCurrentProcess(), &h, 0, TRUE, + DUPLICATE_SAME_ACCESS); + val_process_id = Val_int(h); + + worker_init(); + + return Val_unit; +} + +CAMLprim value win_cleanup(unit) + value unit; +{ + worker_cleanup(); + + (void) WSACleanup(); + + return Val_unit; +} |
