From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA24067; Thu, 26 Jun 2003 21:15:07 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA23978 for ; Thu, 26 Jun 2003 21:15:05 +0200 (MET DST) Received: from mwinf0503.wanadoo.fr (smtp4.wanadoo.fr [193.252.22.26]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5QJF5f17819 for ; Thu, 26 Jun 2003 21:15:05 +0200 (MET DST) Received: from zofo (Mix-Grenoble-103-2-53.w193-250.abo.wanadoo.fr [193.250.90.53]) by mwinf0503.wanadoo.fr (SMTP Server) with SMTP id 5650F680009E for ; Thu, 26 Jun 2003 21:15:04 +0200 (CEST) Message-ID: <003001c33c17$343a0d80$355afac1@zofo> From: "Jean-Baptiste Rouquier" To: References: Subject: Re: [Caml-list] interfacing C and OCaml Date: Thu, 26 Jun 2003 21:02:23 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam: no; 0.00; caml-list:01 interfacing:01 camlprim:01 buffer:01 foo:01 camlparam:01 camlreturn:01 alloc:01 camllocal:01 val:01 ocaml:01 caml:01 int:01 ops:01 float:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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