Subject:
[ruby-ffi] Re: Strange error
From:
Peter
Date:
3/18/10 3:32 PM
To:
ruby-ffi

Ups sorry wrong error code:

...gems/ruby-1.9.2-head%avruby/gems/ffi-0.6.3/lib/ffi/types.rb:47:in
`find_type': Unable to resolve type 'int' (TypeError)

using rvm with 1.9.2 head

On 18 Mrz., 21:25, Peter <peter.schram...@gmx.de> wrote:
> Hi,
> I'm playing around with ffi and stumbled over a strange error:
>
> module XosdRaw
>     extend FFI::Library
>     ffi_lib 'xosd'
>     enum :command, [:percentage,:string,:printf,:slider]
>     attach_function :xosd_display,
> [:pointer,:int,:command,:varargs],:int
> end
>
> gets me this error:
>
> ruby: symbol lookup error: /home/popel/.gem/ruby/1.8/gems/ffi-0.6.3/
> lib/ffi_c.so: undefined symbol: rb_intern2
>
> it seems that the lookup of type fails. I patched types.rb
>
> def self.find_type(name, type_map = nil)
>     type_map = TypeDefs if type_map.nil?
>     code = type_map[name]
>     code = TypeDefs[name] unless code  #<------added this line
>     code = name if !code && name.kind_of?(FFI::Type)
>     raise TypeError, "Unable to resolve type '#{name}'" unless code
>     return code
> end
>
> Now it works. I don't know if this is the right way (perhaps I did
> something completly stupid) but perhaps some of you can have a look at
> this.
>
> THX
>
> Peter

To unsubscribe from this group, send email to ruby-ffi+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.