caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: malc <malc@pulsesoft.com>
To: caml-list@inria.fr
Subject: [Caml-list] Troubles with C->Caml
Date: Sun, 21 Oct 2001 03:36:04 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.21.0110210326440.4590-100000@oyster> (raw)


====
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


             reply	other threads:[~2001-10-20 23:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-20 23:36 malc [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0110210326440.4590-100000@oyster \
    --to=malc@pulsesoft.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).