Package: glib

Type glib:list-t

Details

The g:list-t type specifier performs automatic conversion from a C GList instance to a Lisp list. The elements of the list can be pointers, strings or GObjects.

Examples

Convert a list of strings to and from a C GList instance.
(cffi:convert-to-foreign (list "a" "b" "c") '(g:list-t :string))
=> #.(SB-SYS:INT-SAP #X03B92220)
(cffi:convert-from-foreign * '(g:list-t :string))
=> ("a" "b" "c")    
The g:content-types-registered function is an example for the use of the g:list-t type specifier in the Lisp implementation. It returns a list of strings which is converted from a C GList instance.
(g:content-types-registered)
=> ("application/x-sc" "application/vnd.squashfs" ... )    
 

See also

2025-05-19