Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
girffi.h
Go to the documentation of this file.
1/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 * GObject introspection: Helper functions for ffi integration
3 *
4 * Copyright (C) 2008 Red Hat, Inc
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23
24#pragma once
25
26#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
27#error "Only <girepository.h> can be included directly."
28#endif
29
30#include <ffi.h>
31#include "girepository.h"
32
34
35/**
36 * GIFFIClosureCallback:
37 * @cif: the `ffi_cif` passed to
38 * [method@GIRepository.CallableInfo.create_closure]
39 * @ret: (out caller-allocates): a pointer to the memory used for the function’s
40 * return value
41 * @args: a vector of pointers to memory holding the arguments to the function
42 * @user_data: the user data passed to
43 * [method@GIRepository.CallableInfo.create_closure]
44 *
45 * The function which will be called when a closure created with
46 * [method@GIRepository.CallableInfo.create_closure] is invoked.
47 *
48 * The value of @ret is undefined if the function returns `void`.
49 *
50 * Since: 2.80
51 */
52typedef void (*GIFFIClosureCallback) (ffi_cif *cif,
53 void *ret,
54 void **args,
55 void *user_data);
56
57/**
58 * GIFunctionInvoker:
59 * @cif: the cif
60 * @native_address: the native address
61 *
62 * Structure containing the data necessary to invoke a callable function.
63 *
64 * Since: 2.80
65 */
66typedef struct {
67 ffi_cif cif;
69 /*< private >*/
70 void *padding[3];
72
73/**
74 * GIFFIReturnValue:
75 *
76 * The type of a return value from a callable invocation closure.
77 *
78 * Since: 2.80
79 */
81
83ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean is_pointer);
84
87
90 GIFFIReturnValue *ffi_value,
92
95 GType interface_type,
96 GIFFIReturnValue *ffi_value,
98
101 GIFunctionInvoker *invoker,
102 GError **error);
103
106 GICallableInfo *info,
107 GIFunctionInvoker *invoker,
108 GError **error);
109
112
114
117 ffi_cif *cif,
118 GIFFIClosureCallback callback,
119 void *user_data);
120
123 ffi_closure *closure);
124
127 ffi_closure *closure);
128
CURL_EXTERN int void * arg
Definition curl.h:2622
#define GI_AVAILABLE_IN_ALL
GI_AVAILABLE_IN_ALL ffi_type * gi_type_info_get_ffi_type(GITypeInfo *info)
GIArgument GIFFIReturnValue
Definition girffi.h:80
GI_AVAILABLE_IN_ALL void ** gi_callable_info_get_closure_native_address(GICallableInfo *callable_info, ffi_closure *closure)
GI_AVAILABLE_IN_ALL gboolean gi_function_info_prep_invoker(GIFunctionInfo *info, GIFunctionInvoker *invoker, GError **error)
GI_AVAILABLE_IN_ALL void gi_type_info_extract_ffi_return_value(GITypeInfo *return_info, GIFFIReturnValue *ffi_value, GIArgument *arg)
GI_AVAILABLE_IN_ALL void gi_function_invoker_clear(GIFunctionInvoker *invoker)
GI_AVAILABLE_IN_ALL void gi_type_tag_extract_ffi_return_value(GITypeTag return_tag, GType interface_type, GIFFIReturnValue *ffi_value, GIArgument *arg)
GI_AVAILABLE_IN_ALL gboolean gi_function_invoker_new_for_address(void *addr, GICallableInfo *info, GIFunctionInvoker *invoker, GError **error)
GI_AVAILABLE_IN_ALL ffi_closure * gi_callable_info_create_closure(GICallableInfo *callable_info, ffi_cif *cif, GIFFIClosureCallback callback, void *user_data)
GI_AVAILABLE_IN_ALL ffi_type * gi_type_tag_get_ffi_type(GITypeTag type_tag, gboolean is_pointer)
G_BEGIN_DECLS typedef void(* GIFFIClosureCallback)(ffi_cif *cif, void *ret, void **args, void *user_data)
Definition girffi.h:52
GI_AVAILABLE_IN_ALL void gi_callable_info_destroy_closure(GICallableInfo *callable_info, ffi_closure *closure)
GITypeTag
Definition gitypes.h:311
struct _GICallableInfo GICallableInfo
Definition gitypes.h:56
struct _GIFunctionInfo GIFunctionInfo
Definition gitypes.h:60
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func)
Definition gmacros.h:1401
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
static void error(LoadState *S, const char *why)
void * native_address
Definition girffi.h:68
ffi_cif cif
Definition girffi.h:67