-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNotes
34 lines (25 loc) · 979 Bytes
/
Notes
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
The correct way to do this is to use menhir to read off the git source
code headers, create the tokens, then based off those tokens create an
AST then print that AST out, then compile that auto generated code.
Then that autogenerated code can be an ocaml package for usage on
ocamlfind and opam. Of course the library would need to have tests as
well, using ounit.
Note that getting an exception of:
Fatal error: exception Ctypes_static.IncompleteType
probably means that you forgot a ptr somewhere.
Another possible reason is IncompleteType, like
typedef struct {
char *ptr;
size_t asize, size;
} git_buf;
in which case you have to make an intermediatry struct with no tag
type git_buf
let git_buf =
let struc = structure "" in
let _ = field struc "ptr" (ptr char) in
let _ = field struc "asize" size_t in
let _ = field struc "size" size_t in
seal struc;
typedef
(struc : git_buf structure typ)
"git_buf"