From: David Brown <caml-list@davidb.org>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Binding problem, fixed.
Date: Wed, 30 Apr 2003 14:20:12 -0700 [thread overview]
Message-ID: <20030430212012.GA24849@opus.davidb.org> (raw)
In-Reply-To: <20030430060602.GA20670@opus.davidb.org>
On Tue, Apr 29, 2003 at 11:06:02PM -0700, David Brown wrote:
> I'm trying to create a binding to sqlite. It seems to work most of the
> time, except occasionally it makes the ocaml GC segv.
I found a pair of problems. The first was using: I used Field (var, n)
= ... where I needed to use Store_field.
To, make sure I understand this. I am allowed to use Field (var, n) =
as long as I can guarantee that 'var' is not shared. In other words, it
was allocated with alloc_small (or equivalent), and no other allocations
have taken place. If I'm doing other allocations (say to come up with
the values to store), then I need to make sure that modify gets called.
The second was to use
Store_field (var, n, copy_string (...));
The string needs to be put in a variable and assigned in a separate
step. Otherwise 'var' might get moved by the garbage collector, and C
doesn't guarantee anything about evaluation order.
I put the working versions of the binding files on the web server if
anyone wants to look at them. They still need some cleaning up.
<http://www.davidb.org/sqlite/sqlite-stub.c>
<http://www.davidb.org/sqlite/sqlite.ml>
Dave
-------------------
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 prev parent reply other threads:[~2003-04-30 21:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-30 5:28 [Caml-list] Binding problem David Brown
[not found] ` <200304300941.19681.snob@metalinkltd.com>
2003-04-30 6:13 ` David Brown
[not found] ` <20030430060602.GA20670@opus.davidb.org>
2003-04-30 21:20 ` David Brown [this message]
2003-05-01 4:49 ` David Brown
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=20030430212012.GA24849@opus.davidb.org \
--to=caml-list@davidb.org \
--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