caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Caml Wrappers
@ 2001-03-07 23:58 Ravi Chamarty
  2001-03-08  2:39 ` Jacques Garrigue
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ravi Chamarty @ 2001-03-07 23:58 UTC (permalink / raw)
  To: caml-list


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-03-09 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-07 23:58 [Caml-list] Caml Wrappers Ravi Chamarty
2001-03-08  2:39 ` Jacques Garrigue
2001-03-08  8:45 ` Jocelyn Serot
2001-03-08 18:53   ` Ravi Chamarty
2001-03-08 15:26 ` John Max Skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).