caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Wrapping OCaml function returning a variant
@ 2007-03-28 11:33 Joel Reymont
  2007-03-28 11:47 ` [Caml-list] " Richard Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Joel Reymont @ 2007-03-28 11:33 UTC (permalink / raw)
  To: Caml List

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/






^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-03-28 22:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-28 11:33 Wrapping OCaml function returning a variant Joel Reymont
2007-03-28 11:47 ` [Caml-list] " Richard Jones
2007-03-28 12:25 ` micha
2007-03-28 12:51   ` Joel Reymont
2007-03-28 13:28     ` Richard Jones
2007-03-28 14:34     ` micha
2007-03-28 14:46       ` Joel Reymont
2007-03-28 14:56         ` micha
2007-03-28 14:57         ` Xavier Leroy
2007-03-28 15:07           ` Joel Reymont
2007-03-28 22:47             ` Joel Reymont
2007-03-28 12:55 ` Serge Aleynikov
2007-03-28 12:01   ` Joel Reymont
2007-03-28 13:40     ` Serge Aleynikov
2007-03-28 12:13   ` Joel Reymont
2007-03-28 13:53     ` Serge Aleynikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).