From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: David Brown <caml-list@davidb.org>, caml-list@inria.fr
Subject: Re: CamlIDL and string options.
Date: Thu, 24 Feb 2000 11:21:35 +0100 [thread overview]
Message-ID: <20000224112135.36546@pauillac.inria.fr> (raw)
In-Reply-To: <20000223095425.A20631@davidb.org>; from David Brown on Wed, Feb 23, 2000 at 09:54:25AM -0800
> I'm trying to write a camlidl interface for a function that returns a
> char *. I want the ML result to be a string option. If the returned
> pointer is null, then return None, otherwise return the string it
> points to in Some.
>
> I can make it work, but only by writing my own c2ml routine
I'm afraid this is the only solution with the current CamlIDL. C strings
([string] char *) are treated internally like a special case of arrays
([string] char []), and arrays are assumed not to be "NULL" pointers.
In particular, the "obvious" CamlIDL declaration [string,unique] char *
doesn't work because the "unique" attribute is ignored.
I'll keep that in mind for future versions of CamlIDL.
> In actuality, the function is more complicated than even this. It
> actually returns a char**. There is a function available that returns
> the number of char*'s in it. There is another function that returns
> the length of each char* (provided they aren't NULL).
It looks like you'll really have to write a specialized c2ml routine!
I'm willing to help; just send me (personally, not to the list) some
more details on the C API you're interfacing with.
> The other possibility is that someone else has already written an
> interface of MySQL, and I'm duplicating their effort.
The Caml Hump (http://caml.inria.fr/) lists some OCaml database bindings,
but none for MySQL.
- Xavier Leroy
prev parent reply other threads:[~2000-02-24 14:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-23 17:54 David Brown
2000-02-24 10:21 ` Xavier Leroy [this message]
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=20000224112135.36546@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=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