summaryrefslogtreecommitdiff
path: root/core/extension/gdnative_interface.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-07-08 16:16:02 -0300
committerreduz <reduzio@gmail.com>2021-07-08 17:08:12 -0300
commit44691448911f1d29d4d79dbdd5553734761e57c4 (patch)
treee94aef364ad141c1e96cb775eec1788b03bd8301 /core/extension/gdnative_interface.h
parentd4e5fe6c44cecccd4f925707ccd5bbe1511184e5 (diff)
Redo how instance bindings work
* The harcoded 8 slots are no more and impose limits in the new extension system. * New system is limitless, although it will impose small performance hit with a mutex. * Use a token to request the instance binding. **Warning**: Mono will most likely break as a result of this, will need to be modified to use the new system.
Diffstat (limited to 'core/extension/gdnative_interface.h')
-rw-r--r--core/extension/gdnative_interface.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h
index 318912e889..c1ebb3e76a 100644
--- a/core/extension/gdnative_interface.h
+++ b/core/extension/gdnative_interface.h
@@ -171,6 +171,16 @@ typedef void (*GDNativePtrUtilityFunction)(GDNativeTypePtr r_return, const GDNat
typedef GDNativeObjectPtr (*GDNativeClassConstructor)();
+typedef void *(*GDNativeInstanceBindingCreateCallback)(void *p_token, void *p_instance);
+typedef void (*GDNativeInstanceBindingFreeCallback)(void *p_token, void *p_instance, void *p_binding);
+typedef GDNativeBool (*GDNativeInstanceBindingReferenceCallback)(void *p_token, void *p_instance, GDNativeBool p_reference);
+
+struct GDNativeInstanceBindingCallbacks {
+ GDNativeInstanceBindingCreateCallback create_callback;
+ GDNativeInstanceBindingFreeCallback free_callback;
+ GDNativeInstanceBindingReferenceCallback reference_callback;
+};
+
/* EXTENSION CLASSES */
typedef void *GDExtensionClassInstancePtr;
@@ -373,6 +383,7 @@ typedef struct {
void (*object_method_bind_ptrcall)(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret);
void (*object_destroy)(GDNativeObjectPtr p_o);
GDNativeObjectPtr (*global_get_singleton)(const char *p_name);
+ void *(*object_get_instance_binding)(GDNativeObjectPtr p_o, void *p_token, GDNativeInstanceBindingCallbacks *p_callbacks);
GDNativeObjectPtr (*object_cast_to)(const GDNativeObjectPtr p_object, void *p_class_tag);
GDNativeObjectPtr (*object_get_instance_from_id)(GDObjectInstanceID p_instance_id);