caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Troubles with C->Caml
@ 2001-10-20 23:36 malc
  2001-10-21  3:23 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 5+ messages in thread
From: malc @ 2001-10-20 23:36 UTC (permalink / raw)
  To: caml-list


====
value f (value u) 
{
  value result;
  value res = <some function>;
  if (Is_exception_result (res)) {
#ifdef FULL
    result = alloc_small (1, 2);
    Field (result, 0) = <some value>;
    Field (result, 1) = Extract_exception (res);
#else
    result = alloc_small (1, 1);
    Field (result, 0) = Extract_exception (res);
#endif
    return result;
  }

  result = alloc_small (0, 1);
  Field (result, 0) = <some value>;
  return result;
}
===
type t
type result = A of t | B of (t * exn)

external cfunc : unit -> result = "f"

let _ =
  match cfunc () with
    A t -> print_endline "ok"
  | B (t, e) -> prerr_endline (Printexc.to_string e)
===

The above dumps core in Printexc.to_string, what am i doing wrong here?
Why if: "type result = A of t | B of exn" and -DFULL everything works
fine?

-- 
mailto:malc@pulsesoft.com

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-11-05 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-20 23:36 [Caml-list] Troubles with C->Caml malc
2001-10-21  3:23 ` Daniel de Rauglaudre
2001-10-21 12:27   ` malc
2001-10-21 13:10     ` Dmitry Bely
2001-11-05 17:56     ` Joerg Czeranski

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).