Next: , Previous: , Up: Reference Guide   [Contents][Index]


3.6 Compatibility

Guile-GI normally keeps pointers to the actual objects hidden (for valid concerns about reference handling), but in some instances it might be necessary to fiddle with them. A procedure to do exactly that is defined in (gi compat).

Procedure: fiddle (proc <procedure>) (object <GObject>)
Procedure: fiddle (proc <procedure>) (boxed <GBoxed>)

Apply proc on the internal pointer of object or boxed.

Oftentimes, proc is a procedure from a dynamic library, which takes exactly one argument (the pointer) and returns exactly one output (the Scheme object). Defining many such conversions can be a bit verbose, so we defined a helper for that.

Procedure: dynamic-fiddler name library

Load name from library and convert it to a function, that takes exactly one pointer and returns a Scheme object.

One instance, where the above are necessary, is the cairo library, whose lack of introspection has caused many language bindings to be written without it. When loading (gi compat) in an environment, where (cairo) is available, it will automatically create conversion functions for it.

Procedure: context->cairo context
Procedure: surface->cairo surface
Procedure: font-face->cairo font-face
Procedure: scaled-font->cairo scaled-font

Convert context, surface, font-face or scaled-font to the respective (cairo) smob type. The conversion adds a reference count to the object, so it should be freed manually using the correct -destroy function.


Next: More Stuff, Previous: Utilities, Up: Reference Guide   [Contents][Index]