mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02:00
repository: Add new public gi_type_info_extract_ffi_return_value() API
Dealing with FFI and return values is very tricky; this API allows sharing the bits to do it between gobject-introspection and gjs (and potentially other FFI binding consumers). **NOTE** I swapped the order of the arguments, under the premise that out arguments should generally be last. https://bugzilla.gnome.org/show_bug.cgi?id=668902
This commit is contained in:
parent
0d58e2e924
commit
4b71be0ef0
@ -366,12 +366,10 @@ g_callable_info_iterate_return_attributes (GICallableInfo *info,
|
|||||||
* Also see the ffi_call man page - the storage requirements for return
|
* Also see the ffi_call man page - the storage requirements for return
|
||||||
* values are "special".
|
* values are "special".
|
||||||
*/
|
*/
|
||||||
typedef GIArgument GIFFIReturnValue;
|
void
|
||||||
|
gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
|
||||||
static void
|
GIFFIReturnValue *ffi_value,
|
||||||
set_gargument_from_ffi_return_value (GITypeInfo *return_info,
|
GIArgument *arg)
|
||||||
GIArgument *arg,
|
|
||||||
GIFFIReturnValue *ffi_value)
|
|
||||||
{
|
{
|
||||||
switch (g_type_info_get_tag (return_info)) {
|
switch (g_type_info_get_tag (return_info)) {
|
||||||
case GI_TYPE_TAG_INT8:
|
case GI_TYPE_TAG_INT8:
|
||||||
@ -618,7 +616,7 @@ _g_callable_info_invoke (GIFunctionInfo *info,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_gargument_from_ffi_return_value(rinfo, return_value, &ffi_return_value);
|
gi_type_info_extract_ffi_return_value (rinfo, &ffi_return_value, return_value);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
6
girffi.h
6
girffi.h
@ -46,10 +46,16 @@ struct _GIFunctionInvoker {
|
|||||||
gpointer padding[3];
|
gpointer padding[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef GIArgument GIFFIReturnValue;
|
||||||
|
|
||||||
ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean is_pointer);
|
ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean is_pointer);
|
||||||
|
|
||||||
ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
|
ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
|
||||||
|
|
||||||
|
void gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
|
||||||
|
GIFFIReturnValue *ffi_value,
|
||||||
|
GIArgument *arg);
|
||||||
|
|
||||||
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
|
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
|
||||||
GIFunctionInvoker *invoker,
|
GIFunctionInvoker *invoker,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user