package dkml-c-probe

  1. Overview
  2. Docs

Source file c_abi.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(** New applications should use the {!V3} module instead. *)
module V1 = struct
  type t_os = Android | IOS | Linux | OSX | Windows
  type t_abi =
              | Android_arm64v8a
              | Android_arm32v7a
              | Android_x86
              | Android_x86_64
              | Darwin_arm64
              | Darwin_x86_64
              | Linux_arm64
              | Linux_arm32v6
              | Linux_arm32v7
              | Linux_x86_64
              | Windows_x86_64
              | Windows_x86
              | Windows_arm64
              | Windows_arm32
          
  let get_os : unit -> (t_os, string) result = fun () -> Result.ok (Linux)
  let get_os_name : unit -> (string, string) result = fun () -> Result.ok ("Linux")
  let get_abi : unit -> (t_abi, string) result = fun () -> Result.ok (Linux_x86_64)
  let get_abi_name : unit -> (string, string) result = fun () -> Result.ok ("linux_x86_64")
end (* module V1 *) 

(** New applications should use the {!V3} module instead. *)
module V2 = struct
  type t_os = Android | IOS | Linux | OSX | Windows
  type t_abi =
              | Android_arm64v8a
              | Android_arm32v7a
              | Android_x86
              | Android_x86_64
              | Darwin_arm64
              | Darwin_x86_64
              | Linux_arm64
              | Linux_arm32v6
              | Linux_arm32v7
              | Linux_x86_64
              | Linux_x86
              | Windows_x86_64
              | Windows_x86
              | Windows_arm64
              | Windows_arm32
          
  let get_os : unit -> (t_os, string) result = fun () -> Result.ok (Linux)
  let get_os_name : unit -> (string, string) result = fun () -> Result.ok ("Linux")
  let get_abi : unit -> (t_abi, string) result = fun () -> Result.ok (Linux_x86_64)
  let get_abi_name : unit -> (string, string) result = fun () -> Result.ok ("linux_x86_64")
end (* module V2 *) 

(** Enumerations of the operating system and the ABI, typically from an introspection of OCaml's native C compiler. *)
module V3 = struct
  type t_os =
              | UnknownOS
              | Android
              | DragonFly
              | FreeBSD
              | IOS
              | Linux
              | NetBSD
              | OpenBSD
              | OSX
              | Windows
              
  type t_abi =
              | Unknown_unknown
              | Android_arm32v7a
              | Android_arm64v8a
              | Android_x86
              | Android_x86_64
              | Darwin_arm64
              | Darwin_x86_64
              | DragonFly_x86_64
              | FreeBSD_x86_64
              | Linux_arm32v6
              | Linux_arm32v7
              | Linux_arm64
              | Linux_x86
              | Linux_x86_64
              | NetBSD_x86_64
              | OpenBSD_x86_64
              | Windows_arm32
              | Windows_arm64
              | Windows_x86
              | Windows_x86_64
              
  let get_os : unit -> (t_os, string) result = fun () -> Result.ok (Linux)
  let get_os_name : unit -> (string, string) result = fun () -> Result.ok ("Linux")
  let get_abi : unit -> (t_abi, string) result = fun () -> Result.ok (Linux_x86_64)
  let get_abi_name : unit -> (string, string) result = fun () -> Result.ok ("linux_x86_64")
end (* module V3 *)