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 AAA16623; Thu, 8 Mar 2001 00:58:33 +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 AAA16624 for ; Thu, 8 Mar 2001 00:58:32 +0100 (MET) Received: from stephens.ittc.ukans.edu (stephens.ittc.ukans.edu [129.237.125.220]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f27NwUH02253 for ; Thu, 8 Mar 2001 00:58:31 +0100 (MET) Received: from elroy.ittc.ukans.edu (elroy.ittc.ukans.edu [129.237.126.120]) by stephens.ittc.ukans.edu (8.11.2/8.11.2/ITTC-NOSPAM-NOVIRUS-2.2) with ESMTP id f27NwTL12737 for ; Wed, 7 Mar 2001 17:58:29 -0600 Received: from localhost by elroy.ittc.ukans.edu (8.9.3/KU-4.0-client) id RAA09506; Wed, 7 Mar 2001 17:58:28 -0600 Date: Wed, 7 Mar 2001 17:58:28 -0600 (CST) From: Ravi Chamarty To: caml-list@inria.fr Subject: [Caml-list] Caml Wrappers Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi , I am trying to write OCaml interfaces around a C library. I tried looking at the Unix library and trying to understand it. However, I have much complex data types to deal with.I was wondering if anyone could help me out. Here is a signature of one of the C functions: an_flow_t * an_flow_create(void *mem, an_cred_t *cred, an_cpuspec_t *cspec, an_memspec_t *mspec, an_flowinit_func_t init, void *initarg, an_flowterm_func_t term) Each of these types are complex structures in C. How do I represent these in OCaml. Is it useful to use classes and methods? Or do I use abstract types to represent them ? An example of one of these structures is given below: struct an_flow_t { struct hnode me; /* flow hier link (must be first) */ struct ani_cred *cred; /* credentials */ struct ani_mempool *mpool; /* mempool */ struct ani_chan *chanlist; /* list of channels */ struct ani_threadpool tpool; /* thread pool */ int flags; /* various flags */ an_flowterm_func_t termfunc; /* termination function */ ani_resource_t res; /* reserved resources */ int refs; /* reference count */ ani_ilock_t lock; /* mutual exclusion */ an_flowstats_t stats; /* statistics */ }; I would be grateful for any help. Thanks Ravi ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr