Subject: [ruby-ffi] changing array over struct with ruby ffi |
From: Dor Kalev |
Date: 9/5/11 11:04 AM |
To: ruby-ffi |
Hi there! I have this data typedef struct { unsigned int size; unsigned int e[8]; } SmallAry; typedef struct { unsigned int title; SmallAry form; } Node; typedef struct { Node * e; unsigned int size; } NodeList; int foo(NodeList * states); module Foon class SAry < FFI::Struct layout :size, :pointer, :e, :pointer end class Node < FFI::Struct layout :title, :int, :e, SAry end class NodeList < FFI::Struct layout :title, :int, :e, :pointer end extend FFI::Library ffi_lib "foon.so" attach_function :create_object, [], :pointer attach_function :foo, [ :pointer ], :int end I need foo to update the NodeList it gets and return it to Ruby so I can use it, help will be much appreciated. thanks, DK