combridge

package
v2.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2022 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterVTable

func RegisterVTable[TParent, T IUnknown](guid string, fns ...interface{})

RegisterVTable registers the vtable trampoline methods for the specified ComInterface TBase is the base interface of T, and must be another ComInterface which roots in IUnknown or IUnknown itself. The first paramter of the fn is always the uintptr of the ComObject and the GoObject can be resolved with Resolve(). After having resolved the GoObject the call must be redirected to the GoObject. Typically a trampoline FN looks like this.

func _ICoreWebView2NavigationCompletedEventHandlerInvoke(this uintptr, sender *ICoreWebView2, args *ICoreWebView2NavigationCompletedEventArgs) uintptr {
   return combridge.Resolve[_ICoreWebView2NavigationCompletedEventHandler](this).NavigationCompleted(sender, args)
}

The order of registration must be in the correct order as specified in the IDL of the interface.

func Resolve

func Resolve[T IUnknown](ifceP uintptr) T

Resolve the GoInterface of the specified ComInterfacePointer

Types

type ComObject

type ComObject[T IUnknown] struct {
	// contains filtered or unexported fields
}

ComObject describes an exported go instance to be used as a ComObject which implements the specified Interface.

func New

func New[T IUnknown](obj T) *ComObject[T]

New returns a new ComObject which implements the specified Com Interface, com calls will be redirected to the specified go interface.

func New2

func New2[T IUnknown, T2 IUnknown](obj T, obj2 T2) *ComObject[T]

New2 returns a new ComObject which implements the two specified Com Interfaces, com calls will be redirected to those interfaces accordingly. This is needed if a ComObject should implement two interfaces that are not descendants of each other, then you get multiple inheritance.

func (*ComObject[T]) Close

func (o *ComObject[T]) Close() error

Close releases the native com object from the go side. It will only be destroyed if the ref counter reaches zero. After closing `Ref()` will panic.

func (*ComObject[T]) Ref

func (o *ComObject[T]) Ref() uintptr

Ref returns the native uintptr that points to the ComObject that is an interface pointer to T. This can be used in native calls. If the object has been closed this function will panic.

type IUnknown

type IUnknown interface{}

type IUnknownImpl

type IUnknownImpl struct {
	// contains filtered or unexported fields
}

func IUnknownFromPointer

func IUnknownFromPointer(ref unsafe.Pointer) *IUnknownImpl

IUnknownFromPointer cast a generic pointer into a IUnknownImpl pointer

func IUnknownFromUintptr

func IUnknownFromUintptr(ref uintptr) *IUnknownImpl

IUnknownFromPointer cast native pointer into a IUnknownImpl pointer

func (*IUnknownImpl) AddRef

func (i *IUnknownImpl) AddRef() uint32

func (*IUnknownImpl) QueryInterface

func (i *IUnknownImpl) QueryInterface(refiid *windows.GUID, ppvObject **IUnknownImpl) error

func (*IUnknownImpl) Release

func (i *IUnknownImpl) Release() uint32

type IUnknownVtbl

type IUnknownVtbl struct {
	// contains filtered or unexported fields
}

func (*IUnknownVtbl) AddRef

func (i *IUnknownVtbl) AddRef(this unsafe.Pointer) uint32

func (*IUnknownVtbl) QueryInterface

func (i *IUnknownVtbl) QueryInterface(this unsafe.Pointer, refiid *windows.GUID, ppvObject **IUnknownImpl) error

func (*IUnknownVtbl) Release

func (i *IUnknownVtbl) Release(this unsafe.Pointer) uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL