Subject:
[ruby-ffi] Struct within a Struct
From:
Colby Gutierrez-Kraybill
Date:
3/24/10 12:31 AM
To:
ruby-ffi


I'm attempting to make use of a library with methods that return a
struct by value and that struct contains another struct:

spam_in_a_can_view s = windowShopping(); // note, not returning a
pointer

typedef struct
{
  size_t size;
  double *data;
} spam_in_a_can;

typedef struct
{
  spam_in_a_can can;
}  spam_in_a_can_view;

I'm not sure how to go about this (if it's possible) with FFI.  The
initial layout I would put down as:

class Spam_In_A_Can < FFI::Struct
  layout :size, :size_t,
            :data, :pointer
end

class Spam_In_A_Can_View < FFI::Struct
  layout :can, :pointer # ???
end

attach_function :windowShopping, [], :Spam_In_A_Can_View.by_value


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.