Browse thread
Wrapping OCaml function returning a variant
[
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: | 2007-03-28 (14:56) |
From: | micha <micha-1@f...> |
Subject: | Re: [Caml-list] Wrapping OCaml function returning a variant |
Am Wed, 28 Mar 2007 15:46:54 +0100 schrieb Joel Reymont <joelr1@gmail.com>: > I came up with this. Is it sound? > > > switch (Long_val(v)) { I think you must use Tag_val(x) since your datatype is a constructed type with parameters (it is a block not an integer as for : type x = One | Two, here you would have integers ) > case 0: /* success */ > res = String_val(Field(v, 0)); maybe it's better to strcpy() the string if you want to be independent of the ocaml side cheers Michael