Version française
Home     About     Download     Resources     Contact us    
Browse thread
Help interfacing with C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: malc <malc@p...>
Subject: Re: [Caml-list] Help interfacing with C
On Wed, 16 Aug 2006, Nathaniel Gray wrote:

> Hi folks,
>
> I'm having a heck of a time figuring out why this code *doesn't* work:
>
> /* fdlist is a list of (file_descr * 'a) pairs.  Filter by FD_ISSET */
> static value fdset_to_fdlist2(value fdlist, fd_set *fdset)
> {
> value l, p, newres;
> value res = Val_int(0);
>
> Begin_roots4(l, p, res, newres);  /* I know, this is aggressive */
>   for (l = fdlist; l != Val_int(0); l = Field(l, 1)) {
>     p = Field(l, 0);
>     int fd = Int_val(Field(p, 0));

This here (expanded) does Int_val (Field (Field (l, 0), 0))

<snip>

>     int fd = Int_val(Field(l, 0));

<snip>

I think the difference is self-evident.

--
mailto:malc@pulsesoft.com