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 VAA07081; Wed, 18 Sep 2002 21:54:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA06559 for ; Wed, 18 Sep 2002 21:54:52 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g8IJsp117104 for ; Wed, 18 Sep 2002 21:54:51 +0200 (MET DST) Received: from user-0ccegbj.cable.mindspring.com ([24.199.65.115] helo=cs.cornell.edu) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17rkuQ-0003KA-00 for caml-list@inria.fr; Wed, 18 Sep 2002 12:54:50 -0700 Message-ID: <3D88DA09.4010906@cs.cornell.edu> Date: Wed, 18 Sep 2002 15:54:49 -0400 From: "Yaron M. Minsky" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Bp_val and Data_custom_val Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm wondering if someone can help me out in understanding the difference between Bp_val and Data_custom_val. These are both macros for accessing caml values from C. I lifted and adapted some code from the distribution for building a berkeley DB interface. In that code, Bp_val is used to access the contents of finalized blocks. I adapted that code but shifted to custom blocks, which according to the docs have the same layout. The docs also suggest using Data_custom_val for custom blocks. But when I try to do that, I end up with segfaults. I'm wondering what precisely the difference is. Here's a snippet of my data type definitions and the macros I use for accessing the data contained in the custom blocks holding that data: struct camldb { DB *db; int closed; }; struct camltxn { DB_TXN *txn; int closed; }; #define UW_db(v) (((struct camldb *)Bp_val(v))->db) #define UW_db_closed(v) (((struct camldb *)Bp_val(v))->closed) #define UW_txn(v) (((struct camltxn *)Bp_val(v))->txn) #define UW_txn_closed(v) (((struct camltxn *)Bp_val(v))->closed) Anything fishy about that? And any problem with replacing Bp_val with Data_custom_val here? By the way, in a separate post, I put a URL for where you can download the entire wrapper in question. Here it is again: http://minsky-primus.homeip.net/ocaml/bdb.tar.gz y ------------------- 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