Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: Wrapping OCaml function returning a variant
Is there an example of returning a variant from OCaml into C somewhere?

It's a regular variant, declared like this

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

The other issue is that I don't know how to deal with strings  
allocated in OCaml. Will they be  collected automatically?

The strings _must_ be allocated in OCaml but I can guarantee that  
they will not be modified in the C code. Any suggestions on how to  
deal with this?

	Thanks, Joel

--
http://wagerlabs.com/