[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Brown <caml-list@d...> |
| Subject: | Re: [Caml-list] Binding problem, fixed. |
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