* use of camlidl @ 1999-12-14 13:57 Patrick Goldbronn - SYSCO 1999-12-15 9:03 ` Patrick Goldbronn - SYSCO 1999-12-16 10:35 ` Xavier Leroy 0 siblings, 2 replies; 3+ messages in thread From: Patrick Goldbronn - SYSCO @ 1999-12-14 13:57 UTC (permalink / raw) To: Inria, caml Hello, (sorry for bad english) I have 2 questions about use of camlidl. 1) 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 :) ) I see that for typedef with attribute mltype. I don't see an attribute mlname :( Can I do such thing ? 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 ? Thank's for your light :) -- ##################################### # Patrick GOLDBRONN # # CEA - DRN/DMT/SYSCO # # CE-Saclay, Bâtiment 460 # # 91191 GIF/YVETTE CEDEX (FRANCE) # # # # Tél : 01 69 08 73 55 # # Fax : 01 69 08 96 96 # ##################################### ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: use of camlidl 1999-12-14 13:57 use of camlidl Patrick Goldbronn - SYSCO @ 1999-12-15 9:03 ` Patrick Goldbronn - SYSCO 1999-12-16 10:35 ` Xavier Leroy 1 sibling, 0 replies; 3+ messages in thread From: Patrick Goldbronn - SYSCO @ 1999-12-15 9:03 UTC (permalink / raw) To: Inria, caml Hello, 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 ); - ##################################### # Patrick GOLDBRONN # # CEA - DRN/DMT/SYSCO # # CE-Saclay, Bâtiment 460 # # 91191 GIF/YVETTE CEDEX (FRANCE) # # # # Tél : 01 69 08 73 55 # # Fax : 01 69 08 96 96 # ##################################### ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: use of camlidl 1999-12-14 13:57 use of camlidl Patrick Goldbronn - SYSCO 1999-12-15 9:03 ` Patrick Goldbronn - SYSCO @ 1999-12-16 10:35 ` Xavier Leroy 1 sibling, 0 replies; 3+ messages in thread From: Xavier Leroy @ 1999-12-16 10:35 UTC (permalink / raw) To: Patrick Goldbronn - SYSCO, Inria, caml > 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-12-16 11:54 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-12-14 13:57 use of camlidl Patrick Goldbronn - SYSCO 1999-12-15 9:03 ` Patrick Goldbronn - SYSCO 1999-12-16 10:35 ` Xavier Leroy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox