summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--girepository/girffi.c17
-rw-r--r--girepository/girffi.h5
2 files changed, 22 insertions, 0 deletions
diff --git a/girepository/girffi.c b/girepository/girffi.c
index b3b92195..12770203 100644
--- a/girepository/girffi.c
+++ b/girepository/girffi.c
@@ -349,6 +349,7 @@ g_function_invoker_destroy (GIFunctionInvoker *invoker)
typedef struct {
ffi_closure ffi_closure;
gpointer writable_self;
+ gpointer native_address;
} GIClosureWrapper;
/**
@@ -386,6 +387,7 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
return NULL;
}
closure->writable_self = closure;
+ closure->native_address = exec_ptr;
atypes = g_callable_info_get_ffi_arg_types (callable_info, &n_args);
status = ffi_prep_cif (cif, FFI_DEFAULT_ABI, n_args,
@@ -410,6 +412,21 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
}
/**
+ * g_callable_info_get_closure_native_address:
+ * @callable_info: a callable info from a typelib
+ * @closure: ffi closure
+ *
+ * Gets callable code from ffi_closure prepared by g_callable_info_prepare_closure()
+ */
+gpointer *
+g_callable_info_get_closure_native_address (GICallableInfo *callable_info,
+ ffi_closure *closure)
+{
+ GIClosureWrapper *wrapper = (GIClosureWrapper *)closure;
+ return wrapper->native_address;
+}
+
+/**
* g_callable_info_free_closure:
* @callable_info: a callable info from a typelib
* @closure: ffi closure
diff --git a/girepository/girffi.h b/girepository/girffi.h
index d8a57369..c6cb5e91 100644
--- a/girepository/girffi.h
+++ b/girepository/girffi.h
@@ -95,6 +95,11 @@ ffi_closure * g_callable_info_prepare_closure (GICallableInfo *callabl
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data);
+
+GI_AVAILABLE_IN_1_70
+gpointer * g_callable_info_get_closure_native_address (GICallableInfo *callable_info,
+ ffi_closure *closure);
+
GI_AVAILABLE_IN_ALL
void g_callable_info_free_closure (GICallableInfo *callable_info,
ffi_closure *closure);