girffi

## girffi girffi |

## Synopsis

    void                (*GIFFIClosureCallback)             (ffi_cif *Param1,
                                                             void *Param2,
                                                             void **Param3,
                                                             void *Param4);
                        GIFunctionInvoker;
    void                gi_cclosure_marshal_generic         (GClosure *closure,
                                                             GValue *return_gvalue,
                                                             guint n_param_values,
                                                             const GValue *param_values,
                                                             gpointer invocation_hint,
                                                             gpointer marshal_data);
    ffi_type *          g_type_info_get_ffi_type            (GITypeInfo *info);
    gboolean            g_function_info_prep_invoker        (GIFunctionInfo *info,
                                                             GIFunctionInvoker *invoker,
                                                             GError **error);
    void                g_function_invoker_destroy          (GIFunctionInvoker *invoker);
    ffi_closure *       g_callable_info_prepare_closure     (GICallableInfo *callable_info,
                                                             ffi_cif *cif,
                                                             GIFFIClosureCallback callback,
                                                             gpointer user_data);
    void                g_callable_info_free_closure        (GICallableInfo *callable_info,
                                                             ffi_closure *closure);

## Description

## Details

### GIFFIClosureCallback ()

    void                (*GIFFIClosureCallback)             (ffi_cif *Param1,
                                                             void *Param2,
                                                             void **Param3,
                                                             void *Param4);

`Param1` : |
`Param2` : |
`Param3` : |
`Param4` : |

### GIFunctionInvoker

    typedef struct {
      ffi_cif cif;
      gpointer native_address;
    } GIFunctionInvoker;

ffi_cif `cif`; | the cif
gpointer `native_address`; | the native adress

### gi_cclosure_marshal_generic ()

    void                gi_cclosure_marshal_generic         (GClosure *closure,
                                                             GValue *return_gvalue,
                                                             guint n_param_values,
                                                             const GValue *param_values,
                                                             gpointer invocation_hint,
                                                             gpointer marshal_data);

`closure` : |
`return_gvalue` : |
`n_param_values` : |
`param_values` : |
`invocation_hint` : |
`marshal_data` : |

### g_type_info_get_ffi_type ()

    ffi_type *          g_type_info_get_ffi_type            (GITypeInfo *info);

`info` : | A GITypeInfo
Returns : | A ffi_type corresponding to the platform default C ABI for `info`.

### g_function_info_prep_invoker ()

    gboolean            g_function_info_prep_invoker        (GIFunctionInfo *info,
                                                             GIFunctionInvoker *invoker,
                                                             GError **error);

Initialize the caller-allocated `invoker` structure with a cache of information needed to invoke the C function corresponding to `info` with the platform's default ABI.

A primary intent of this function is that a dynamic structure allocated by a language binding could contain a GIFunctionInvoker structure inside the binding's function mapping.

`info` : | A GIFunctionInfo
`invoker` : | Output invoker structure
`error` : | A GError
Returns : | `TRUE` on success, `FALSE` otherwise with `error` set.

### g_function_invoker_destroy ()

    void                g_function_invoker_destroy          (GIFunctionInvoker *invoker);

`invoker` : |

### g_callable_info_prepare_closure ()

    ffi_closure *       g_callable_info_prepare_closure     (GICallableInfo *callable_info,
                                                             ffi_cif *cif,
                                                             GIFFIClosureCallback callback,
                                                             gpointer user_data);

Prepares a callback for ffi invocation.

`callable_info` : | a callable info from a typelib
`cif` : | a ffi_cif structure
`callback` : | the ffi callback
`user_data` : | data to be passed into the callback
Returns : | the ffi_closure or NULL on error. The return value should be freed by calling `g_callable_info_free_closure()`.

### g_callable_info_free_closure ()

    void                g_callable_info_free_closure        (GICallableInfo *callable_info,
                                                             ffi_closure *closure);

Frees a ffi_closure returned from `g_callable_info_prepare_closure()`

`callable_info` : | a callable info from a typelib
`closure` : | ffi closure