Module: FFI::Library
- Included in:
- Win32::Certstore::Mixin::Crypto
- Defined in:
- lib/win32/certstore/mixin/crypto.rb
Overview
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.
Instance Method Summary collapse
Instance Method Details
#safe_attach_function(win32_func, *args) ⇒ Object
34 35 36 37 38 39 40 |
# 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 |