Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] interfacing C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-06-26 (19:15)
From: Jean-Baptiste Rouquier <jb.rouquier@w...>
Subject: Re: [Caml-list] interfacing C and OCaml
> Can anybody explain me if there is anyway that I can pass in
> a (int*int*int*int*int) from a C function to OCaml.

Do you want to call C auxiliary function from Caml, or are you writing your
main programm in C and using some Caml functions ?
Both are very well explained in the manual, though it may take a while to
read it.
Don't hesitate to ask me for a complete example if your main programm is in
Caml (I haven't learn yet how to write the main programm in C).

À propos, I have some questions about the manual :
1. Should I use
CAMLprim value input(value channel, value buffer, value offset, value
  return ...

as in 18.1.2 in the manual, or

void foo (value v1, value v2, value v3)
CAMLparam3 (v1, v2, v3);

as in 18.5.1, or both ? I think at least the second.

I use
  alloc(2*n, Double_array_tag.)
to create a float array of size n (then I initialize it), is it correct ?

3. Is it correct to store p in the custom block v by
v = alloc_custom(ops, 4, 0, 1);
(my_type *) Data_custom_val(v) = p;
When does the parameter "size" (here "4") vary ?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: