FFI enums not supported in jruby?

hi there,

in ruby this work, in jruby doesn’t:

A = enum( :foo, :bar )
class Whatever < FFI::ManagedStruct
  layout :name, A
end

In the ffi/types.rb I see there is no enum defined (but in the
ffi/types.rb
from the ruby gem, it is)

I’ve tried to add just:

add_typedef(Types::Enum, :enum)

but it doesn’t work, a silly try to fix it. I don’t see where and how
the
types can be defined. Has anyone use enums?

Thanks.

2010/1/19 Jesús García Sáez [email protected]

from the ruby gem, it is)

I’ve tried to add just:

add_typedef(Types::Enum, :enum)

but it doesn’t work, a silly try to fix it. I don’t see where and how the
types can be defined. Has anyone use enums?

Thanks.

I could use just :uint8 instead of the enum (in both layout definition
and
attach_function calls) and after that use the enum (A[:foo] is 0,
A[:bar] is
1). But it’s weird that there is ffi/enum.rb working properly and it’s
not
defined in ffi/types.rb.

2010/1/19 Jesús García Sáez [email protected]:

I could use just :uint8 instead of the enum (in both layout definition and
attach_function calls) and after that use the enum (A[:foo] is 0, A[:bar] is
1). But it’s weird that there is ffi/enum.rb working properly and it’s not
defined in ffi/types.rb.

It looks like we’ve fallen a bit out of sync with MRI FFI. Can you
help us patch it up and get it in sync?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email