| GObject Introspection Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
typedef GIFunctionInfo; enum GInvokeError; enum GIFunctionInfoFlags; #define G_INVOKE_ERROR const gchar * g_function_info_get_symbol (GIFunctionInfo *info); GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info); GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info); GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info); gboolean g_function_info_invoke (GIFunctionInfo *info,const GArgument *in_args,int n_in_args,const GArgument *out_args,int n_out_args,GArgument *return_value,GError **error);
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.
typedef GIBaseInfo GIFunctionInfo;
Represents a function, eg arguments and return value.
typedef enum
{
G_INVOKE_ERROR_FAILED,
G_INVOKE_ERROR_SYMBOL_NOT_FOUND,
G_INVOKE_ERROR_ARGUMENT_MISMATCH
} GInvokeError;
An error occuring while invoking a function via
g_function_info_invoke().
| invokation failed, unknown error. | |
| symbol couldn't be found in any of the libraries associated with the typelib of the function. | |
| the arguments provided didn't match the expected arguments for the functions type signature. |
typedef enum
{
GI_FUNCTION_IS_METHOD = 1 << 0,
GI_FUNCTION_IS_CONSTRUCTOR = 1 << 1,
GI_FUNCTION_IS_GETTER = 1 << 2,
GI_FUNCTION_IS_SETTER = 1 << 3,
GI_FUNCTION_WRAPS_VFUNC = 1 << 4,
GI_FUNCTION_THROWS = 1 << 5
} GIFunctionInfoFlags;
Flags for a GIFunctionInfo struct.
| is a method. | |
| is a constructor. | |
| is a getter of a GIPropertyInfo. | |
| is a setter of a GIPropertyInfo. | |
| represents a virtual function. | |
| the function may throw an error. |
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().
|
a GIFunctionInfo |
Returns : |
the symbol |
GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
Obtain the GIFunctionInfoFlags for the info.
|
a GIFunctionInfo |
Returns : |
the flags |
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.
|
a GIFunctionInfo |
Returns : |
the property or NULL if not set. Free it with
g_base_info_unref() when done.. transfer full. |
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.
|
a GIFunctionInfo |
Returns : |
the virtual function or NULL if not set.
Free it by calling g_base_info_unref() when done.. transfer full. |
gboolean g_function_info_invoke (GIFunctionInfo *info,const GArgument *in_args,int n_in_args,const GArgument *out_args,int n_out_args,GArgument *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.
|
a GIFunctionInfo describing the function to invoke |
|
an array of GArguments, one for each in
parameter of info. If there are no in parameter, in_args
can be NULL
|
|
the length of the in_args array
|
|
an array of GArguments, one for each out
parameter of info. If there are no out parameters, out_args
may be NULL
|
|
the length of the out_args array
|
|
return location for the return value of the
function. If the function returns void, return_value may be
NULL
|
|
return location for detailed error information, or NULL
|
Returns : |
TRUE if the function has been invoked, FALSE if an
error occurred.
|