[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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
length)
{
return ...
}
as in 18.1.2 in the manual, or
void foo (value v1, value v2, value v3)
{
CAMLparam3 (v1, v2, v3);
...
CAMLreturn0;
}
as in 18.5.1, or both ? I think at least the second.
------------------------------------------------
2.
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
CAMLlocal(v);
v = alloc_custom(ops, 4, 0, 1);
(my_type *) Data_custom_val(v) = p;
?
When does the parameter "size" (here "4") vary ?
Thanks,
Jean-Baptiste.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners