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 MAA24094 for caml-redistribution; Thu, 16 Dec 1999 12:54:55 +0100 (MET) 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 LAA01036 for ; Thu, 16 Dec 1999 11:35:51 +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 LAA24135; Thu, 16 Dec 1999 11:35:50 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA13358; Thu, 16 Dec 1999 11:35:49 +0100 (MET) Message-ID: <19991216113549.20150@pauillac.inria.fr> Date: Thu, 16 Dec 1999 11:35:49 +0100 From: Xavier Leroy To: Patrick Goldbronn - SYSCO , "Inria, caml" Subject: Re: use of camlidl References: <38564CD2.E5C1A7E4@cea.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <38564CD2.E5C1A7E4@cea.fr>; from Patrick Goldbronn - SYSCO on Tue, Dec 14, 1999 at 01:57:38PM +0000 Sender: weis > I'd like to give the caml name of the interfacing C function : > for example, I have the function : > void NP_do (int n , double val) ; > With camlidl, I get the caml function nP_do: int -> float -> unit ; > I'd like to have the name 'do' (in module np.ml :) ) "do" is problematic because it's a Caml reserved keyword. But more to the point, CamlIDL doesn't (yet) allow the Caml name of a function to be specified, it derives it automatically from the name given in the IDL file. I admit an mlname(...) attribute on function declarations could be useful, though. > 2) > I see in documentation (in section 3.7 page 10) > value c2ml (ty * input) ; > void ml2c (value input, ty * output) ; > > But in generated C file, I see another argument : 'camlidl_ctx _ctx' > > So (after error during compilation) I added camlidl_ctx in function c2ml > and ml2c but I don't use it (of course I don't know what is it :( ) > > value c2ml (ty * input, camlidl_ctx _ctx) ; > void ml2c (value input, ty * output, camlidl_ctx _ctx) ; > > That's right nevertheless ? Yes. The "camlidl_ctx" argument is useful if your c2ml and ml2c functions need to perform dynamic allocation of C memory (a la malloc()) and want the allocated memory to be automatically freed when the stub code terminates. If you don't need dynamic allocation in your conversion functions, you can safely ignore the extra parameter. > I have another trouble : I can't define a string array. > I have the C function : > void NP_initialize( int argc, char ** argv, int *err ); > Where argc is the length of the string array argv (of course) and err is > an error code. > I can't retrieve the 'string array' in ml file. I've got 'char option > array' ?? > void NP_initialize( [in] int argc, [in,length_is(argc)] char ** argv, > [out] int *err ); You need to tell CamlIDL that those "char *" are really strings: void NP_initialize( [in] int argc, [in,length_is(argc),string*] char ** argv, [out] int *err ); Hope this helps, - Xavier Leroy