// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gobject import ( "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject/types" ) // This function is provided by the user and should produce a copy // of the passed in boxed structure. type BoxedCopyFunc func(uintptr) uintptr // This function is provided by the user and should free the boxed // structure passed. type BoxedFreeFunc func(uintptr) var xBoxedCopy func(types.GType, uintptr) uintptr // Provide a copy of a boxed structure @src_boxed which is of type @boxed_type. func BoxedCopy(BoxedTypeVar types.GType, SrcBoxedVar uintptr) uintptr { cret := xBoxedCopy(BoxedTypeVar, SrcBoxedVar) return cret } var xBoxedFree func(types.GType, uintptr) // Free the boxed structure @boxed which is of type @boxed_type. func BoxedFree(BoxedTypeVar types.GType, BoxedVar uintptr) { xBoxedFree(BoxedTypeVar, BoxedVar) } var xBoxedTypeRegisterStatic func(string, uintptr, uintptr) types.GType // This function creates a new %G_TYPE_BOXED derived type id for a new // boxed type with name @name. // // Boxed type handling functions have to be provided to copy and free // opaque boxed structures of this type. // // For the general case, it is recommended to use G_DEFINE_BOXED_TYPE() // instead of calling g_boxed_type_register_static() directly. The macro // will create the appropriate `*_get_type()` function for the boxed type. func BoxedTypeRegisterStatic(NameVar string, BoxedCopyVar *BoxedCopyFunc, BoxedFreeVar *BoxedFreeFunc) types.GType { var BoxedCopyVarRef uintptr if BoxedCopyVar != nil { BoxedCopyVarPtr := uintptr(unsafe.Pointer(BoxedCopyVar)) if cbRefPtr, ok := glib.GetCallback(BoxedCopyVarPtr); ok { BoxedCopyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) uintptr { cbFn := *BoxedCopyVar return cbFn(arg0) } BoxedCopyVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(BoxedCopyVarPtr, BoxedCopyVarRef, BoxedCopyVar) } } var BoxedFreeVarRef uintptr if BoxedFreeVar != nil { BoxedFreeVarPtr := uintptr(unsafe.Pointer(BoxedFreeVar)) if cbRefPtr, ok := glib.GetCallback(BoxedFreeVarPtr); ok { BoxedFreeVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *BoxedFreeVar cbFn(arg0) } BoxedFreeVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(BoxedFreeVarPtr, BoxedFreeVarRef, BoxedFreeVar) } } cret := xBoxedTypeRegisterStatic(NameVar, BoxedCopyVarRef, BoxedFreeVarRef) return cret } func init() { core.SetPackageName("GOBJECT", "gobject-2.0") core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GOBJECT") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xBoxedCopy, libs, "g_boxed_copy") core.PuregoSafeRegister(&xBoxedFree, libs, "g_boxed_free") core.PuregoSafeRegister(&xBoxedTypeRegisterStatic, libs, "g_boxed_type_register_static") }