From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA08072; Mon, 12 Jul 2004 15:16:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA06902 for ; Mon, 12 Jul 2004 15:16:42 +0200 (MET DST) Received: from web53203.mail.yahoo.com (web53203.mail.yahoo.com [206.190.39.219]) by nez-perce.inria.fr (8.12.10/8.12.10) with SMTP id i6CDGfEV019110 for ; Mon, 12 Jul 2004 15:16:42 +0200 Message-ID: <20040712131641.85775.qmail@web53203.mail.yahoo.com> Received: from [155.97.235.184] by web53203.mail.yahoo.com via HTTP; Mon, 12 Jul 2004 06:16:41 PDT Date: Mon, 12 Jul 2004 06:16:41 -0700 (PDT) From: Andy Yang Subject: Re: [Caml-list] Toplevel crashes when trying to call external functions To: caml-list Caml In-Reply-To: <86A9CD32-D3F7-11D8-B633-00039310CAE8@inria.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-757866967-1089638201=:82141" X-Miltered: at nez-perce with ID 40F28F39.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 crashes:01 solver:01 solver:01 damien:01 damien:01 camlparam:01 camllocal:01 val:01 val:01 camlreturn:01 mng:99 camlparam:01 mng:99 char:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --0-757866967-1089638201=:82141 Content-Type: text/plain; charset=us-ascii 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 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! --0-757866967-1089638201=:82141 Content-Type: text/html; charset=us-ascii
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! --0-757866967-1089638201=:82141-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners