Skip to content

Instantly share code, notes, and snippets.

@nanki
Created May 7, 2012 04:42
Show Gist options
  • Save nanki/2625962 to your computer and use it in GitHub Desktop.
Save nanki/2625962 to your computer and use it in GitHub Desktop.
require 'ffi'
module Union
extend ::FFI::Library
ffi_lib 'union'
class U < FFI::Union
layout(
:d, :double,
:i, :int
)
end
attach_function :dump_union, [U.by_value], :void
end
u = Union::U.new
u[:d] = 1.0
Union.dump_union u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment