No release in over 3 years
Low commit activity in last 3 years
The ffi-win32-extensions library adds additional methods to the FFI and String classes to aid in the development of FFI based libraries on MS Windows.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

ffi-win32-extensions

Gem Version

A Ruby library that adds some core FFI and String methods to supplement development of Ruby libraries on Windows.

Installation

gem install ffi-win32-extensions

Details

The following FFI::MemoryPointer methods have been added:

  • read_array_of_string - For reading char** types.
  • read_wide_string - Similar to read_string but for wide char* types.

The following FFI module functions have been added:

  • windows_error_message - A Windows specific error string using FormatMessage.
  • raise_windows_error - Raises a windows specific error using windows_error_message.

The following String instance methods have been added:

  • wincode - Converts a string to UTF-16LE for use in wide char functions.
  • wstrip - Like String#strip, but for wide strings.
  • read_wide_string - Reads a Ruby string up to the first double null.

Example

require 'ffi/win32/extensions'

str = old_string.wincode rv = SomeWideFunctionW(str)

unless rv == 0
  FFI.raise_windows_error('SomeWindowsFunction', rv)
end

Copyright

(C) 2016 Daniel J. Berger, All Rights Reserved

Warranty

This package is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

License

Apache 2.0

Author

Daniel Berger