Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Wrapping OCaml function returning a variant
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-28 (12:01)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Caml-list] Wrapping OCaml function returning a variant

On Mar 28, 2007, at 1:55 PM, Serge Aleynikov wrote:

> You can read the section 18.3.4 of 
> manual-ocaml/manual032.html

It does not clearly explain how to handle variant types in C code.  
Maybe I'm dumb but I did not understand it.

> Then if still unclear, examine:
> or any other C-interface library available on Caml Hump: http:// 

It looks like you are using polymorphic variants in new syntax. Maybe  
I'm wrong but it doesn't work for me

# type foo = [Null | Int of int];;
Syntax error

I still don't understand how I can handle regular variants of the  
following type returned by OCaml to the C side

> type morpher_output =
>   | Success of string
>   | Error of string * int * int * int

	Thanks, Joel