Module: WinFFI::LibBase
- Extended by:
- FFI::Library
- Defined in:
- lib/win-ffi/core/lib_base.rb,
lib/win-ffi/core/typedef/core.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(c) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/win-ffi/core/lib_base.rb', line 43 def self.extended(c) c.extend FFI::Library instance_variables.each do |v| value = instance_variable_get(v) value = value.dup unless value.is_a?(Fixnum) || value.is_a?(Symbol) c.instance_variable_set(v, value) end end |
.string_from_byte_array(array) ⇒ Object
33 34 35 |
# File 'lib/win-ffi/core/lib_base.rb', line 33 def self.string_from_byte_array(array) array[0, array.index(0) || array.length].pack('C*').encode(Encoding::UTF_8) end |
Instance Method Details
#encoded_function(name, *args, ruby_name: nil) ⇒ Object
27 28 29 30 |
# File 'lib/win-ffi/core/lib_base.rb', line 27 def encoded_function(name, *args, ruby_name: nil) ruby_name = name unless ruby_name attach_function ruby_name, name + WinFFI.encoding, *args end |