Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Toplevel crashes when trying to call external functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andy Yang <yyu08@y...>
Subject: Re: [Caml-list] Toplevel crashes when trying to call external functions
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!