module Win32::Certstore::Mixin::Crypto::FFI::Library

Attempts to use FFI's attach_function method to link a native Win32 function into the calling module. If this fails a dummy method is defined which when called, raises a helpful exception to the end-user.

Public Instance Methods

safe_attach_function(win32_func, *args) click to toggle source
# File lib/win32/certstore/mixin/crypto.rb, line 34
def safe_attach_function(win32_func, *args)
  attach_function(win32_func.to_sym, *args)
rescue FFI::NotFoundError
  define_method(win32_func.to_sym) do |*margs|
    raise NotImplementedError, "This version of Windows does not implement the Win32 function [#{win32_func}]."
  end
end