Subject:
[ruby-ffi] initialize :strings in structs
From:
Jan
Date:
8/21/09 6:01 PM
To:
ruby-ffi


hey all,

is it possible (with NiceFFI) to initialize strings inside a struct?
e.g.

class Config < NiceFFI::Struct
    layout(:api_version, :int,
      :cache_location, :string
      :settings_location, :string
   )

Config.new(:api_version=>1, :cache_location=>"/tmp")

I get

/Library/Ruby/Gems/1.8/gems/nice-ffi-0.1/lib/nice-ffi/nicestruct.rb:
380:in `[]=': Cannot set :string fields (ArgumentError)

is this a problem with FFI in general or could support for this added?

 thanks,

   jan