summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <td@matasano.com>2015-01-27 08:07:05 -0600
committertduehr <td@matasano.com>2015-01-27 08:07:05 -0600
commitaa8ed9925e64005610fb581d38350027cf179de2 (patch)
tree8f2cc921e72d07651b42d39b6ce8a9930c5a0ccd
parent262fd7935ed82796cf6539a9b66966cfc85af7e1 (diff)
parentd409ba50f20338a73a8cc915062610aefe6ddba9 (diff)
downloadffi-aa8ed9925e64005610fb581d38350027cf179de2.tar.gz
Merge pull request #407 from bfoz/bfoz
Added an example for structures containing pointers to functions
-rw-r--r--lib/ffi/struct.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ffi/struct.rb b/lib/ffi/struct.rb
index c699e0b..599ee9b 100644
--- a/lib/ffi/struct.rb
+++ b/lib/ffi/struct.rb
@@ -256,6 +256,12 @@ module FFI
# :field2 => :pointer,
# :field3 => :string
# end
+ # @example Creating a layout with pointers to functions
+ # class MyFunctionTable < Struct
+ # layout :function1, callback([:int, :int], :int),
+ # :function2, callback([:pointer], :void),
+ # :field3, :string
+ # end
# @note Creating a layout from a hash +spec+ is supported only for Ruby 1.9.
def layout(*spec)
#raise RuntimeError, "struct layout already defined for #{self.inspect}" if defined?(@layout)