Debian Codegraph @

gi/pygi-closure.h

raw
1 /* -*- Mode: C; c-basic-offset: 4 -*-
2 * vim: tabstop=4 shiftwidth=4 expandtab
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef __PYGI_CLOSURE_H__
19 #define __PYGI_CLOSURE_H__
20
21
22 /* Workaround for FFI_GO_CLOSURES not being defined on macOS
23 * See also: https://github.com/openjdk/jdk17u-dev/pull/741
24 */
25 #ifndef FFI_GO_CLOSURES
26 #define FFI_GO_CLOSURES 0
27 #endif
28
29 #include <ffi.h>
30
31 #include "pygi-cache.h"
32
33 G_BEGIN_DECLS
34
35
36 /* Private */
37
38 typedef struct _PyGICClosure {
39 GICallableInfo *info;
40 PyObject *function;
41
42 ffi_closure *closure;
43 ffi_cif cif;
44
45 GIScopeType scope;
46
47 PyObject *user_data;
48
49 PyGIClosureCache *cache;
50 } PyGICClosure;
51
52 void _pygi_invoke_closure_free (PyGICClosure *invoke_closure);
53
54 PyGICClosure *_pygi_make_native_closure (GICallableInfo *info,
55 PyGIClosureCache *cache,
56 GIScopeType scope, PyObject *function,
57 PyObject *user_data);
58
59 G_END_DECLS
60
61 #endif /* __PYGI_CLOSURE_H__ */