require 'ffi' module VirtualBox module COM module FFI extend ::FFI::Library # FFI specific types NSRESULT_TYPE = :uint # Returns a Class which creates an FFI interface to the specified # com interface and potentially a parent class as well. def self.create_interface(interface, parent=nil) klass = Class.new(Interface) const_set(interface, klass) klass.com_interface(interface, parent) klass end # Represents a VirtualBox XPCOM C interface, which is a C struct # which emulates an object (a struct with function pointers # and getters/setters). This class does **a lot** of magic which pretty # much represents everything wrong about ruby programmers, but keep # in mind it is well tested and well commented, and the meta-programming # was done out of a need to keep things DRY between Windows and Unix # operating systems. class Interface extend ::FFI::Library attr_reader :vtbl_parent attr_reader :vtbl class <