@@ -442,6 +442,8 @@ typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_user
442442
443443typedef void (* GDExtensionCallableCustomToString )(void * callable_userdata , GDExtensionBool * r_is_valid , GDExtensionStringPtr r_out );
444444
445+ typedef GDExtensionInt (* GDExtensionCallableCustomGetArgumentCount )(void * callable_userdata , GDExtensionBool * r_is_valid );
446+
445447typedef struct {
446448 /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.
447449 *
@@ -471,7 +473,40 @@ typedef struct {
471473 GDExtensionCallableCustomLessThan less_than_func ;
472474
473475 GDExtensionCallableCustomToString to_string_func ;
474- } GDExtensionCallableCustomInfo ;
476+ } GDExtensionCallableCustomInfo ; // Deprecated. Use GDExtensionCallableCustomInfo2 instead.
477+
478+ typedef struct {
479+ /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.
480+ *
481+ * `token` should point to an address that uniquely identifies the GDExtension (for example, the
482+ * `GDExtensionClassLibraryPtr` passed to the entry symbol function.
483+ *
484+ * `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and
485+ * `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.
486+ *
487+ * The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.
488+ *
489+ * `is_valid_func` is necessary if the validity of the callable can change before destruction.
490+ *
491+ * `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed.
492+ */
493+ void * callable_userdata ;
494+ void * token ;
495+
496+ GDObjectInstanceID object_id ;
497+
498+ GDExtensionCallableCustomCall call_func ;
499+ GDExtensionCallableCustomIsValid is_valid_func ;
500+ GDExtensionCallableCustomFree free_func ;
501+
502+ GDExtensionCallableCustomHash hash_func ;
503+ GDExtensionCallableCustomEqual equal_func ;
504+ GDExtensionCallableCustomLessThan less_than_func ;
505+
506+ GDExtensionCallableCustomToString to_string_func ;
507+
508+ GDExtensionCallableCustomGetArgumentCount get_argument_count_func ;
509+ } GDExtensionCallableCustomInfo2 ;
475510
476511/* SCRIPT INSTANCE EXTENSION */
477512
@@ -2450,6 +2485,7 @@ typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptIn
24502485/**
24512486 * @name callable_custom_create
24522487 * @since 4.2
2488+ * @deprecated in Godot 4.3. Use `callable_custom_create2` instead.
24532489 *
24542490 * Creates a custom Callable object from a function pointer.
24552491 *
@@ -2460,6 +2496,19 @@ typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptIn
24602496 */
24612497typedef void (* GDExtensionInterfaceCallableCustomCreate )(GDExtensionUninitializedTypePtr r_callable , GDExtensionCallableCustomInfo * p_callable_custom_info );
24622498
2499+ /**
2500+ * @name callable_custom_create2
2501+ * @since 4.3
2502+ *
2503+ * Creates a custom Callable object from a function pointer.
2504+ *
2505+ * Provided struct can be safely freed once the function returns.
2506+ *
2507+ * @param r_callable A pointer that will receive the new Callable.
2508+ * @param p_callable_custom_info The info required to construct a Callable.
2509+ */
2510+ typedef void (* GDExtensionInterfaceCallableCustomCreate2 )(GDExtensionUninitializedTypePtr r_callable , GDExtensionCallableCustomInfo2 * p_callable_custom_info );
2511+
24632512/**
24642513 * @name callable_custom_get_userdata
24652514 * @since 4.2
0 commit comments