Subject:
[ruby-ffi] using C macros
From:
mixtli
Date:
5/20/10 10:22 AM
To:
ruby-ffi

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.