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: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Toplevel crashes when trying to call external functions
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 = "<<hex<<solver<<endl;
>   CAMLreturn ( val );
> }
>
> void zchaff_ReadCnf(value mng, value filename)
> {
>   CAMLparam2(mng, filename);
>   SAT_Manager solver = (void*)Int32_val(mng);
>   cout<<"solver = "<<hex <<solver <<endl;
>   assert(solver != NULL);
>   char * fn = String_val(filename);
>   cout<<"file = "<<fn <<endl;
>   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 FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners