
Hello, I made so progress on the LibDB difficulties. Attached is patch that allows an access path instead of an identifier in call and fun hooks. The behaviour is unchanged if the access path happens to be a single identifier, otherwise the hook will behave as a get hook followed by a call via the extracted FunPtr. I decided to simply treat the "object" as an additional parameter. This way I can retain all the comfort of semi-automatic marshalling. For the "object oriented" calls this implies that the object has to be passed to the hook twice. It turns out that nothing special is required to get rid of this annoyance, I can just reuse the "one marshaller for two C parameters" feature. Here's what a typical declaration would look like, including auxillary definitions:
newtype Db k v = Db (Ptr ()) with2Db (Db p) k = k (p,p)
{# fun unsafe DB->close as ^ { with2Db* `Db k v'&, `Int' } -> `()' chk_db_close* #}
chk_db_close = throwIfNotNull "dbClose"
and this is what the call would look like:
dbClose db 0
The code is not perfect, yet. I cut-and-pasted some and a refactoring would be in order. However, I'd like to see how this extension works out by binding to more of Libdbs, first. Feel free to comment on any stupid ideas above. For the #defines, used mostly for flags, I'm going with the enum workaround found in the examples directory. That's good enough for now. BTW, Manuel, thanks for a very useful and quite hackable tool. Regards, Udo. -- The future isn't what it used to be. (It never was.)