From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA13392 for caml-redistribution@pauillac.inria.fr; Thu, 24 Feb 2000 15:32:54 +0100 (MET) Resent-Message-Id: <200002241432.PAA13392@pauillac.inria.fr> Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA24754 for ; Thu, 24 Feb 2000 11:21:43 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id LAA04262; Thu, 24 Feb 2000 11:21:37 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA29380; Thu, 24 Feb 2000 11:21:35 +0100 (MET) Message-ID: <20000224112135.36546@pauillac.inria.fr> Date: Thu, 24 Feb 2000 11:21:35 +0100 From: Xavier Leroy To: David Brown , caml-list@inria.fr Subject: Re: CamlIDL and string options. References: <20000223095425.A20631@davidb.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <20000223095425.A20631@davidb.org>; from David Brown on Wed, Feb 23, 2000 at 09:54:25AM -0800 Resent-From: weis@pauillac.inria.fr Resent-Date: Thu, 24 Feb 2000 15:32:54 +0100 Resent-To: caml-redistribution@pauillac.inria.fr > 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