1 /**************************************************************************/
2 /* */
3 /* OCaml */
4 /* */
5 /* Xavier Leroy and Pascal Cuoq, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. */
9 /* */
10 /* All rights reserved. This file is distributed under the terms of */
11 /* the GNU Lesser General Public License version 2.1, with the */
12 /* special exception on linking described in the file LICENSE. */
13 /* */
14 /**************************************************************************/
15
16 #include <stdio.h>
17 #include <fcntl.h>
18 #include <stdlib.h>
19 #include <caml/mlvalues.h>
20 #include "winworker.h"
21 #include "windbug.h"
22
23 value val_process_id;
24
win_startup(unit)25 CAMLprim value win_startup(unit)
26 value unit;
27 {
28 WSADATA wsaData;
29 int i;
30 HANDLE h;
31
32 (void) WSAStartup(MAKEWORD(2, 0), &wsaData);
33 DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(),
34 GetCurrentProcess(), &h, 0, TRUE,
35 DUPLICATE_SAME_ACCESS);
36 val_process_id = Val_int(h);
37
38 worker_init();
39
40 return Val_unit;
41 }
42
win_cleanup(unit)43 CAMLprim value win_cleanup(unit)
44 value unit;
45 {
46 worker_cleanup();
47
48 (void) WSACleanup();
49
50 return Val_unit;
51 }
52