Subject:
Re: [ruby-ffi] using C macros
From:
Wayne Meissner
Date:
5/20/10 6:57 PM
To:
ruby-ffi@googlegroups.com

No, C macros are not present in the library as code, since they are
handled by the  C pre-processor.

You could just implement ruby versions of those macros (they should be
pretty simple).

On 21 May 2010 01:22, mixtli <ronmcclain75@gmail.com> wrote:
> Is it possible to access macros such as FD_SET and FD_ZERO?  I'm
> trying to wrap net-snmp, specifically the snmp_select_info function
> which is called in C like so:
>
>  int fds = 0, block = 1;
>  fd_set fdset;
>  struct timeval timeout;
>  FD_ZERO(&fdset);
>  snmp_select_info(&fds, &fdset, &timeout, &block);
>  fds = select(fds, &fdset, 0,0, block ? 0 : &timeout);
>  if(fds) { snmp_read(&fdset); } else { snmp_timeout(); }
>
>
> I've been trying to do it with ffi-inliner, but haven't had much
> luck.  Any pointers would be appreciated.
>
>