GIFunctionInfo

GIFunctionInfo — Struct representing a function

Types and Values

Description

GIFunctionInfo represents a function, method or constructor. To find out what kind of entity a GIFunctionInfo represents, call g_function_info_get_flags().

See also GICallableInfo for information on how to retreive arguments and other metadata.

Struct hierarchy

  GIBaseInfo
   +----GICallableInfo
         +----GIFunctionInfo
         +----GISignalInfo
         +----GIVFuncInfo

Functions

GI_IS_FUNCTION_INFO()

#define             GI_IS_FUNCTION_INFO(info)

Checks if info is a GIFunctionInfo.

Parameters

info

an info structure

 

g_function_info_get_flags ()

GIFunctionInfoFlags
g_function_info_get_flags (GIFunctionInfo *info);

Obtain the GIFunctionInfoFlags for the info .

Parameters

info

a GIFunctionInfo

 

Returns

the flags


g_function_info_get_property ()

GIPropertyInfo *
g_function_info_get_property (GIFunctionInfo *info);

Obtain the property associated with this GIFunctionInfo. Only GIFunctionInfo with the flag GI_FUNCTION_IS_GETTER or GI_FUNCTION_IS_SETTER have a property set. For other cases, NULL will be returned.

Parameters

info

a GIFunctionInfo

 

Returns

the property or NULL if not set. Free it with g_base_info_unref() when done.

[transfer full]


g_function_info_get_symbol ()

const gchar *
g_function_info_get_symbol (GIFunctionInfo *info);

Obtain the symbol of the function. The symbol is the name of the exported function, suitable to be used as an argument to g_module_symbol().

Parameters

info

a GIFunctionInfo

 

Returns

the symbol


g_function_info_get_vfunc ()

GIVFuncInfo *
g_function_info_get_vfunc (GIFunctionInfo *info);

Obtain the virtual function associated with this GIFunctionInfo. Only GIFunctionInfo with the flag GI_FUNCTION_WRAPS_VFUNC has a virtual function set. For other cases, NULL will be returned.

Parameters

info

a GIFunctionInfo

 

Returns

the virtual function or NULL if not set. Free it by calling g_base_info_unref() when done.

[transfer full]


g_function_info_invoke ()

gboolean
g_function_info_invoke (GIFunctionInfo *info,
                        const GIArgument *in_args,
                        int n_in_args,
                        const GIArgument *out_args,
                        int n_out_args,
                        GIArgument *return_value,
                        GError **error);

Invokes the function described in info with the given arguments. Note that inout parameters must appear in both argument lists. This function uses dlsym() to obtain a pointer to the function, so the library or shared object containing the described function must either be linked to the caller, or must have been g_module_symbol()ed before calling this function.

[skip]

Parameters

info

a GIFunctionInfo describing the function to invoke

 

in_args

an array of GIArguments, one for each in parameter of info . If there are no in parameter, in_args can be NULL.

[array length=n_in_args]

n_in_args

the length of the in_args array

 

out_args

an array of GIArguments, one for each out parameter of info . If there are no out parameters, out_args may be NULL.

[array length=n_out_args]

n_out_args

the length of the out_args array

 

return_value

return location for the return value of the function. If the function returns void, return_value may be NULL

 

error

return location for detailed error information, or NULL

 

Returns

TRUE if the function has been invoked, FALSE if an error occurred.


g_invoke_error_quark ()

GQuark
g_invoke_error_quark (void);

TODO

Returns

TODO

Types and Values

GIFunctionInfo

typedef GIBaseInfo GIFunctionInfo;

Represents a function, eg arguments and return value.


enum GIFunctionInfoFlags

Flags for a GIFunctionInfo struct.

Members

GI_FUNCTION_IS_METHOD

is a method.

 

GI_FUNCTION_IS_CONSTRUCTOR

is a constructor.

 

GI_FUNCTION_IS_GETTER

is a getter of a GIPropertyInfo.

 

GI_FUNCTION_IS_SETTER

is a setter of a GIPropertyInfo.

 

GI_FUNCTION_WRAPS_VFUNC

represents a virtual function.

 

GI_FUNCTION_THROWS

the function may throw an error.

 

G_INVOKE_ERROR

#define G_INVOKE_ERROR (g_invoke_error_quark ())

TODO


enum GInvokeError

An error occuring while invoking a function via g_function_info_invoke().

Members

G_INVOKE_ERROR_FAILED

invokation failed, unknown error.

 

G_INVOKE_ERROR_SYMBOL_NOT_FOUND

symbol couldn't be found in any of the libraries associated with the typelib of the function.

 

G_INVOKE_ERROR_ARGUMENT_MISMATCH

the arguments provided didn't match the expected arguments for the functions type signature.