caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andy Yang <yyu08@yahoo.com>
To: caml-list Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Toplevel crashes when trying to call external functions
Date: Mon, 12 Jul 2004 06:16:41 -0700 (PDT)	[thread overview]
Message-ID: <20040712131641.85775.qmail@web53203.mail.yahoo.com> (raw)
In-Reply-To: <86A9CD32-D3F7-11D8-B633-00039310CAE8@inria.fr>

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

Hi, 
 
The two functions are defines as follows in ocaml:
 
type zchaff_solver
external zchaff_InitManager : unit -> zchaff_solver = "zchaff_InitManager"
external zchaff_ReadCnf : zchaff_solver -> string -> unit = "zchaff_ReadCnf"
 
and my usage of these two functions are :
 
# let mysolver = zchaff_InitManager () ;;
# let _ = zchaff_ReadCnf (mysolver) ("testcaser/1.cnf");;  
   
Thanks !
 
Andy
Damien Doligez <damien.doligez@inria.fr> wrote:
On Jul 11, 2004, at 20:58, Andy Yang wrote:

> value zchaff_InitManager(void)
> {
> CAMLparam0();
> CAMLlocal1(val);
> void* solver = SAT_InitManager();
> val = copy_int32((int)solver);
> cout<<"solver = "<> CAMLreturn ( val );
> }
>
> void zchaff_ReadCnf(value mng, value filename)
> {
> CAMLparam2(mng, filename);
> SAT_Manager solver = (void*)Int32_val(mng);
> cout<<"solver = "<> assert(solver != NULL);
> char * fn = String_val(filename);
> cout<<"file = "<> read_cnf(solver, fn);
> CAMLreturn0;
> }

This code looks OK. How did you declare these two functions on
the OCaml side of things?

> Thus I should follows ocaml's Tag rules. However, the
> problem still exists. Tracing with gdb, I noticed that
> the toplevel still crashes in function obj_tag.

Sounds like the toplevel is trying to pretty-print one of your
values.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs 
		
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

[-- Attachment #2: Type: text/html, Size: 2275 bytes --]

  reply	other threads:[~2004-07-12 13:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-11  1:20 Andy Yang
2004-07-11 18:14 ` art yerkes
2004-07-11 18:58   ` Andy Yang
2004-07-12 11:04     ` Gerd Stolpmann
2004-07-12 11:35     ` Damien Doligez
2004-07-12 13:16       ` Andy Yang [this message]
2004-07-12 13:33         ` Olivier Andrieu
2004-07-12 15:39           ` Andy Yang
2004-07-12  6:55 ` Anne Pacalet
2004-07-12  3:39 John Prevost
2004-07-12  4:46 ` Andy Yang
2004-07-12 10:55 ` Gerd Stolpmann
2004-07-12 12:03   ` Richard Jones
2004-07-12 12:55     ` Jean-Christophe Filliatre

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=20040712131641.85775.qmail@web53203.mail.yahoo.com \
    --to=yyu08@yahoo.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).