module WindowsCOM::COMVtbl_
Public Class Methods
[](parent_vtbl, spec)
click to toggle source
# File lib/windows_com/common.rb, line 154 def self.[](parent_vtbl, spec) =begin IUnknown::Vtbl::Spec example (*this* ptr is NOT included in spec signature): { QueryInterface: [[:pointer, :pointer], :long], AddRef: [[], :ulong], Release: [[], :ulong] } =end Class.new(FFI::Struct) { const_set :ParentVtbl, parent_vtbl const_set :Spec, {} self::Spec.merge!(self::ParentVtbl::Spec) if self::ParentVtbl self::Spec.merge!(spec) layout_args = self::Spec.map { |name, sig| params, ret = sig ffi_params = [:pointer, *params] # prepend *this* ptr to FFI func signature [name, callback(ffi_params, ret)] } layout_args.flatten! layout(*layout_args) } end