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 LAA21757; Thu, 31 Jan 2002 11:11:24 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 LAA21482 for ; Thu, 31 Jan 2002 11:11:23 +0100 (MET) Received: from mail.cs.net.pl (cyber.cs.net.pl [62.233.142.98]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g0VABMD28388 for ; Thu, 31 Jan 2002 11:11:22 +0100 (MET) Received: by mail.cs.net.pl (Postfix, from userid 510) id F3453E27; Thu, 31 Jan 2002 11:11:12 +0100 (CET) Date: Thu, 31 Jan 2002 11:11:12 +0100 From: Tomasz Zielonka To: CAML list Subject: [Caml-list] Using C values in ocaml code Message-ID: <20020131101112.GA30020@cs.net.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi I'm linking ocaml code with a program written in C. I want to use some C type values within ocaml code (store in structures, pass around, apply to external functions, etc.). Below is a simplified example: type cvalue external get_some_value : unit -> cvalue = "get_some_value" external process_value : cvalue -> cvalue = "process_value" example C primitive: value get_some_value(value unit) { CAMLparam1(unit); Datum x; x = foo(); CAMLreturn((value) x) } What I'm afraid of is: Can there be any problem with Garbage Collector ... if cvalue is word aligned pointer? (I think I'll be ok) ... if cvalue can have any value? My situation is that cvalue is word with any value possible - eg. it can be a pointer or an integer. Do I have to put it in a custom block or something? tom -- .-. Tomasz Zielonka CYBER SERVICE oo| programista http://www.cs.net.pl /`'\ zielony@cs.net.pl (\_;/) tel: [48] (22) 723-06-79 | tel/fax: [48] (22) 723-01-75 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr