Subject:
[ruby-ffi] Re: calling internal ruby functions
From:
mixtli
Date:
4/29/11 7:58 AM
To:
ruby-ffi

Thank you.  That worked perfectly.

Fortunately, I don't have to deal much with those macros because I'm
using the net-snmp snmp_sess_select_info() function to prepare the
descriptors.
The only thing I have to do is allocate a pointer to an fd_set, which
I've hardcoded as a FFI::MemoryPointer.new(:pointer, 128).  This works
on my system,
but I'm sure it's a bad idea.  I was considering using RubyInline to
write simple wrappers around the macros.  I'll give that a shot
tonight, unless you have a better suggestion.



On Apr 29, 5:17 am, Aman Gupta <themastermi...@gmail.com> wrote:
> You can use ffi_lib(FFI::CURRENT_PROCESS).
>
> How are you emulating the FD_* macros via FFI?
>
>   Aman
>
>
>
> On Friday, April 29, 2011, mixtli <ronmcclai...@gmail.com> wrote:
> > I wanted to call rb_thread_select to do some async polling, so I made
> > a quick wrapper.  It actually works fine, but I have to specify the
> > full path to my libruby.dylib in the call to ffi_lib.   If I just put
> > "libruby", it segfaults.   Is there some standard mechanism for
> > forcing ffi to use the libs from the rvm environment?   This is for a
> > public gem (http://github.com/mixtli/net-snmp), so I'd like it to
> > automagically work in the user's environment.
>
> > Also, is there a standard set of wrappers for ruby internals similar
> > to the set for libc (ffi-libc)?
>
> > And finally, since I'm here..  Anyone else having problems requiring
> > ffi-libc on snow leopard?  A bunch of the functions don't seem to be
> > defined on my system (clearenv, stdin, etc).