From: "Yaron M. Minsky" <yminsky@CS.Cornell.EDU>
To: caml-list@inria.fr
Subject: [Caml-list] Bp_val and Data_custom_val
Date: Wed, 18 Sep 2002 15:54:49 -0400 [thread overview]
Message-ID: <3D88DA09.4010906@cs.cornell.edu> (raw)
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
next reply other threads:[~2002-09-18 19:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-18 19:54 Yaron M. Minsky [this message]
[not found] ` <3D891635.4030002@htec.demon.co.uk>
2002-09-19 1:41 ` Yaron M. Minsky
2002-09-19 2:32 ` Berkeley DB wrapper is fixed (was: Re: [Caml-list] Bp_val and Data_custom_val) Yaron M. Minsky
2002-09-20 9:56 ` [Caml-list] Bp_val and Data_custom_val Xavier Leroy
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=3D88DA09.4010906@cs.cornell.edu \
--to=yminsky@cs.cornell.edu \
--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