Browse thread
Accessing constructors (tags) from C
-
Raj Bandyopadhyay
- Eric Cooper
-
David Allsopp
- Mathias Kende
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Mathias Kende <mathias@k...> |
| Subject: | RE: [Caml-list] Accessing constructors (tags) from C |
Le dimanche 23 novembre 2008 à 18:42 +0000, David Allsopp a écrit : > See Section 18.3.4 of the manual. In your example below, Null is an > integer > 0 and Int is a 1-word block with tag 1. In C, Null is Val_int(0) and t > = > Int(x) is caml_alloc(1, 1); Store_field(t, 0, Val_int(x)). (Int x) is t = caml_alloc(1,0); Store_field(t,0,Val_int(x)). Because the numbering of the fields starts from zero separately for the constant and non-constant constructors (definitely, this is error prone). Mathias