Path: blob/master/core/extension/gdextension_interface.h
9898 views
/**************************************************************************/1/* gdextension_interface.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132/* This is a C class header, you can copy it and use it directly in your own binders.33* Together with the JSON file, you should be able to generate any binder.34*/3536#ifndef __cplusplus37#include <stddef.h>38#include <stdint.h>3940typedef uint32_t char32_t;41typedef uint16_t char16_t;42#else43#include <cstddef>44#include <cstdint>4546extern "C" {47#endif4849/* VARIANT TYPES */5051typedef enum {52GDEXTENSION_VARIANT_TYPE_NIL,5354/* atomic types */55GDEXTENSION_VARIANT_TYPE_BOOL,56GDEXTENSION_VARIANT_TYPE_INT,57GDEXTENSION_VARIANT_TYPE_FLOAT,58GDEXTENSION_VARIANT_TYPE_STRING,5960/* math types */61GDEXTENSION_VARIANT_TYPE_VECTOR2,62GDEXTENSION_VARIANT_TYPE_VECTOR2I,63GDEXTENSION_VARIANT_TYPE_RECT2,64GDEXTENSION_VARIANT_TYPE_RECT2I,65GDEXTENSION_VARIANT_TYPE_VECTOR3,66GDEXTENSION_VARIANT_TYPE_VECTOR3I,67GDEXTENSION_VARIANT_TYPE_TRANSFORM2D,68GDEXTENSION_VARIANT_TYPE_VECTOR4,69GDEXTENSION_VARIANT_TYPE_VECTOR4I,70GDEXTENSION_VARIANT_TYPE_PLANE,71GDEXTENSION_VARIANT_TYPE_QUATERNION,72GDEXTENSION_VARIANT_TYPE_AABB,73GDEXTENSION_VARIANT_TYPE_BASIS,74GDEXTENSION_VARIANT_TYPE_TRANSFORM3D,75GDEXTENSION_VARIANT_TYPE_PROJECTION,7677/* misc types */78GDEXTENSION_VARIANT_TYPE_COLOR,79GDEXTENSION_VARIANT_TYPE_STRING_NAME,80GDEXTENSION_VARIANT_TYPE_NODE_PATH,81GDEXTENSION_VARIANT_TYPE_RID,82GDEXTENSION_VARIANT_TYPE_OBJECT,83GDEXTENSION_VARIANT_TYPE_CALLABLE,84GDEXTENSION_VARIANT_TYPE_SIGNAL,85GDEXTENSION_VARIANT_TYPE_DICTIONARY,86GDEXTENSION_VARIANT_TYPE_ARRAY,8788/* typed arrays */89GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY,90GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY,91GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY,92GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY,93GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY,94GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY,95GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY,96GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY,97GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY,98GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR4_ARRAY,99100GDEXTENSION_VARIANT_TYPE_VARIANT_MAX101} GDExtensionVariantType;102103typedef enum {104/* comparison */105GDEXTENSION_VARIANT_OP_EQUAL,106GDEXTENSION_VARIANT_OP_NOT_EQUAL,107GDEXTENSION_VARIANT_OP_LESS,108GDEXTENSION_VARIANT_OP_LESS_EQUAL,109GDEXTENSION_VARIANT_OP_GREATER,110GDEXTENSION_VARIANT_OP_GREATER_EQUAL,111112/* mathematic */113GDEXTENSION_VARIANT_OP_ADD,114GDEXTENSION_VARIANT_OP_SUBTRACT,115GDEXTENSION_VARIANT_OP_MULTIPLY,116GDEXTENSION_VARIANT_OP_DIVIDE,117GDEXTENSION_VARIANT_OP_NEGATE,118GDEXTENSION_VARIANT_OP_POSITIVE,119GDEXTENSION_VARIANT_OP_MODULE,120GDEXTENSION_VARIANT_OP_POWER,121122/* bitwise */123GDEXTENSION_VARIANT_OP_SHIFT_LEFT,124GDEXTENSION_VARIANT_OP_SHIFT_RIGHT,125GDEXTENSION_VARIANT_OP_BIT_AND,126GDEXTENSION_VARIANT_OP_BIT_OR,127GDEXTENSION_VARIANT_OP_BIT_XOR,128GDEXTENSION_VARIANT_OP_BIT_NEGATE,129130/* logic */131GDEXTENSION_VARIANT_OP_AND,132GDEXTENSION_VARIANT_OP_OR,133GDEXTENSION_VARIANT_OP_XOR,134GDEXTENSION_VARIANT_OP_NOT,135136/* containment */137GDEXTENSION_VARIANT_OP_IN,138GDEXTENSION_VARIANT_OP_MAX139140} GDExtensionVariantOperator;141142// In this API there are multiple functions which expect the caller to pass a pointer143// on return value as parameter.144// In order to make it clear if the caller should initialize the return value or not145// we have two flavor of types:146// - `GDExtensionXXXPtr` for pointer on an initialized value147// - `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value148//149// Notes:150// - Not respecting those requirements can seems harmless, but will lead to unexpected151// segfault or memory leak (for instance with a specific compiler/OS, or when two152// native extensions start doing ptrcall on each other).153// - Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`,154// zero-initializing the variable should not be considered a valid initialization method here !155// - Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for156// them it is always safe to skip the constructor for the return value if you are in a hurry ;-)157158typedef void *GDExtensionVariantPtr;159typedef const void *GDExtensionConstVariantPtr;160typedef void *GDExtensionUninitializedVariantPtr;161typedef void *GDExtensionStringNamePtr;162typedef const void *GDExtensionConstStringNamePtr;163typedef void *GDExtensionUninitializedStringNamePtr;164typedef void *GDExtensionStringPtr;165typedef const void *GDExtensionConstStringPtr;166typedef void *GDExtensionUninitializedStringPtr;167typedef void *GDExtensionObjectPtr;168typedef const void *GDExtensionConstObjectPtr;169typedef void *GDExtensionUninitializedObjectPtr;170typedef void *GDExtensionTypePtr;171typedef const void *GDExtensionConstTypePtr;172typedef void *GDExtensionUninitializedTypePtr;173typedef const void *GDExtensionMethodBindPtr;174typedef int64_t GDExtensionInt;175typedef uint8_t GDExtensionBool;176typedef uint64_t GDObjectInstanceID;177typedef void *GDExtensionRefPtr;178typedef const void *GDExtensionConstRefPtr;179180/* VARIANT DATA I/O */181182typedef enum {183GDEXTENSION_CALL_OK,184GDEXTENSION_CALL_ERROR_INVALID_METHOD,185GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT, // Expected a different variant type.186GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS, // Expected lower number of arguments.187GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS, // Expected higher number of arguments.188GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL,189GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST, // Used for const call.190} GDExtensionCallErrorType;191192typedef struct {193GDExtensionCallErrorType error;194int32_t argument;195int32_t expected;196} GDExtensionCallError;197198typedef void (*GDExtensionVariantFromTypeConstructorFunc)(GDExtensionUninitializedVariantPtr, GDExtensionTypePtr);199typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionUninitializedTypePtr, GDExtensionVariantPtr);200typedef void *(*GDExtensionVariantGetInternalPtrFunc)(GDExtensionVariantPtr);201typedef void (*GDExtensionPtrOperatorEvaluator)(GDExtensionConstTypePtr p_left, GDExtensionConstTypePtr p_right, GDExtensionTypePtr r_result);202typedef void (*GDExtensionPtrBuiltInMethod)(GDExtensionTypePtr p_base, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return, int p_argument_count);203typedef void (*GDExtensionPtrConstructor)(GDExtensionUninitializedTypePtr p_base, const GDExtensionConstTypePtr *p_args);204typedef void (*GDExtensionPtrDestructor)(GDExtensionTypePtr p_base);205typedef void (*GDExtensionPtrSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_value);206typedef void (*GDExtensionPtrGetter)(GDExtensionConstTypePtr p_base, GDExtensionTypePtr r_value);207typedef void (*GDExtensionPtrIndexedSetter)(GDExtensionTypePtr p_base, GDExtensionInt p_index, GDExtensionConstTypePtr p_value);208typedef void (*GDExtensionPtrIndexedGetter)(GDExtensionConstTypePtr p_base, GDExtensionInt p_index, GDExtensionTypePtr r_value);209typedef void (*GDExtensionPtrKeyedSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionConstTypePtr p_value);210typedef void (*GDExtensionPtrKeyedGetter)(GDExtensionConstTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionTypePtr r_value);211typedef uint32_t (*GDExtensionPtrKeyedChecker)(GDExtensionConstVariantPtr p_base, GDExtensionConstVariantPtr p_key);212typedef void (*GDExtensionPtrUtilityFunction)(GDExtensionTypePtr r_return, const GDExtensionConstTypePtr *p_args, int p_argument_count);213214typedef GDExtensionObjectPtr (*GDExtensionClassConstructor)();215216typedef void *(*GDExtensionInstanceBindingCreateCallback)(void *p_token, void *p_instance);217typedef void (*GDExtensionInstanceBindingFreeCallback)(void *p_token, void *p_instance, void *p_binding);218typedef GDExtensionBool (*GDExtensionInstanceBindingReferenceCallback)(void *p_token, void *p_binding, GDExtensionBool p_reference);219220typedef struct {221GDExtensionInstanceBindingCreateCallback create_callback;222GDExtensionInstanceBindingFreeCallback free_callback;223GDExtensionInstanceBindingReferenceCallback reference_callback;224} GDExtensionInstanceBindingCallbacks;225226/* EXTENSION CLASSES */227228typedef void *GDExtensionClassInstancePtr;229230typedef GDExtensionBool (*GDExtensionClassSet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value);231typedef GDExtensionBool (*GDExtensionClassGet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);232typedef uint64_t (*GDExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance);233234typedef struct {235GDExtensionVariantType type;236GDExtensionStringNamePtr name;237GDExtensionStringNamePtr class_name;238uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`).239GDExtensionStringPtr hint_string;240uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`).241} GDExtensionPropertyInfo;242243typedef struct {244GDExtensionStringNamePtr name;245GDExtensionPropertyInfo return_value;246uint32_t flags; // Bitfield of `GDExtensionClassMethodFlags`.247int32_t id;248249/* Arguments: `default_arguments` is an array of size `argument_count`. */250uint32_t argument_count;251GDExtensionPropertyInfo *arguments;252253/* Default arguments: `default_arguments` is an array of size `default_argument_count`. */254uint32_t default_argument_count;255GDExtensionVariantPtr *default_arguments;256} GDExtensionMethodInfo;257258typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count);259typedef void (*GDExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list);260typedef void (*GDExtensionClassFreePropertyList2)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count);261typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name);262typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);263typedef GDExtensionBool (*GDExtensionClassValidateProperty)(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property);264typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionClassNotification2 instead.265typedef void (*GDExtensionClassNotification2)(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed);266typedef void (*GDExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out);267typedef void (*GDExtensionClassReference)(GDExtensionClassInstancePtr p_instance);268typedef void (*GDExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance);269typedef void (*GDExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);270typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance)(void *p_class_userdata);271typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance2)(void *p_class_userdata, GDExtensionBool p_notify_postinitialize);272typedef void (*GDExtensionClassFreeInstance)(void *p_class_userdata, GDExtensionClassInstancePtr p_instance);273typedef GDExtensionClassInstancePtr (*GDExtensionClassRecreateInstance)(void *p_class_userdata, GDExtensionObjectPtr p_object);274typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name);275typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual2)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name, uint32_t p_hash);276typedef void *(*GDExtensionClassGetVirtualCallData)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name);277typedef void *(*GDExtensionClassGetVirtualCallData2)(void *p_class_userdata, GDExtensionConstStringNamePtr p_name, uint32_t p_hash);278typedef void (*GDExtensionClassCallVirtualWithData)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, void *p_virtual_call_userdata, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);279280typedef struct {281GDExtensionBool is_virtual;282GDExtensionBool is_abstract;283GDExtensionClassSet set_func;284GDExtensionClassGet get_func;285GDExtensionClassGetPropertyList get_property_list_func;286GDExtensionClassFreePropertyList free_property_list_func;287GDExtensionClassPropertyCanRevert property_can_revert_func;288GDExtensionClassPropertyGetRevert property_get_revert_func;289GDExtensionClassNotification notification_func;290GDExtensionClassToString to_string_func;291GDExtensionClassReference reference_func;292GDExtensionClassUnreference unreference_func;293GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.294GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.295GDExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function.296GDExtensionClassGetRID get_rid_func;297void *class_userdata; // Per-class user data, later accessible in instance bindings.298} GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo4 instead.299300typedef struct {301GDExtensionBool is_virtual;302GDExtensionBool is_abstract;303GDExtensionBool is_exposed;304GDExtensionClassSet set_func;305GDExtensionClassGet get_func;306GDExtensionClassGetPropertyList get_property_list_func;307GDExtensionClassFreePropertyList free_property_list_func;308GDExtensionClassPropertyCanRevert property_can_revert_func;309GDExtensionClassPropertyGetRevert property_get_revert_func;310GDExtensionClassValidateProperty validate_property_func;311GDExtensionClassNotification2 notification_func;312GDExtensionClassToString to_string_func;313GDExtensionClassReference reference_func;314GDExtensionClassUnreference unreference_func;315GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.316GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.317GDExtensionClassRecreateInstance recreate_instance_func;318// Queries a virtual function by name and returns a callback to invoke the requested virtual function.319GDExtensionClassGetVirtual get_virtual_func;320// Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that321// need or benefit from extra data when calling virtual functions.322// Returns user data that will be passed to `call_virtual_with_data_func`.323// Returning `NULL` from this function signals to Godot that the virtual function is not overridden.324// Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.325// You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`.326GDExtensionClassGetVirtualCallData get_virtual_call_data_func;327// Used to call virtual functions when `get_virtual_call_data_func` is not null.328GDExtensionClassCallVirtualWithData call_virtual_with_data_func;329GDExtensionClassGetRID get_rid_func;330void *class_userdata; // Per-class user data, later accessible in instance bindings.331} GDExtensionClassCreationInfo2; // Deprecated. Use GDExtensionClassCreationInfo4 instead.332333typedef struct {334GDExtensionBool is_virtual;335GDExtensionBool is_abstract;336GDExtensionBool is_exposed;337GDExtensionBool is_runtime;338GDExtensionClassSet set_func;339GDExtensionClassGet get_func;340GDExtensionClassGetPropertyList get_property_list_func;341GDExtensionClassFreePropertyList2 free_property_list_func;342GDExtensionClassPropertyCanRevert property_can_revert_func;343GDExtensionClassPropertyGetRevert property_get_revert_func;344GDExtensionClassValidateProperty validate_property_func;345GDExtensionClassNotification2 notification_func;346GDExtensionClassToString to_string_func;347GDExtensionClassReference reference_func;348GDExtensionClassUnreference unreference_func;349GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.350GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.351GDExtensionClassRecreateInstance recreate_instance_func;352// Queries a virtual function by name and returns a callback to invoke the requested virtual function.353GDExtensionClassGetVirtual get_virtual_func;354// Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that355// need or benefit from extra data when calling virtual functions.356// Returns user data that will be passed to `call_virtual_with_data_func`.357// Returning `NULL` from this function signals to Godot that the virtual function is not overridden.358// Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.359// You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`.360GDExtensionClassGetVirtualCallData get_virtual_call_data_func;361// Used to call virtual functions when `get_virtual_call_data_func` is not null.362GDExtensionClassCallVirtualWithData call_virtual_with_data_func;363GDExtensionClassGetRID get_rid_func;364void *class_userdata; // Per-class user data, later accessible in instance bindings.365} GDExtensionClassCreationInfo3; // Deprecated. Use GDExtensionClassCreationInfo4 instead.366367typedef struct {368GDExtensionBool is_virtual;369GDExtensionBool is_abstract;370GDExtensionBool is_exposed;371GDExtensionBool is_runtime;372GDExtensionConstStringPtr icon_path;373GDExtensionClassSet set_func;374GDExtensionClassGet get_func;375GDExtensionClassGetPropertyList get_property_list_func;376GDExtensionClassFreePropertyList2 free_property_list_func;377GDExtensionClassPropertyCanRevert property_can_revert_func;378GDExtensionClassPropertyGetRevert property_get_revert_func;379GDExtensionClassValidateProperty validate_property_func;380GDExtensionClassNotification2 notification_func;381GDExtensionClassToString to_string_func;382GDExtensionClassReference reference_func;383GDExtensionClassUnreference unreference_func;384GDExtensionClassCreateInstance2 create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract.385GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory.386GDExtensionClassRecreateInstance recreate_instance_func;387// Queries a virtual function by name and returns a callback to invoke the requested virtual function.388GDExtensionClassGetVirtual2 get_virtual_func;389// Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that390// need or benefit from extra data when calling virtual functions.391// Returns user data that will be passed to `call_virtual_with_data_func`.392// Returning `NULL` from this function signals to Godot that the virtual function is not overridden.393// Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.394// You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`.395GDExtensionClassGetVirtualCallData2 get_virtual_call_data_func;396// Used to call virtual functions when `get_virtual_call_data_func` is not null.397GDExtensionClassCallVirtualWithData call_virtual_with_data_func;398void *class_userdata; // Per-class user data, later accessible in instance bindings.399} GDExtensionClassCreationInfo4;400401typedef GDExtensionClassCreationInfo4 GDExtensionClassCreationInfo5;402403typedef void *GDExtensionClassLibraryPtr;404405/* Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension. */406typedef void (*GDExtensionEditorGetClassesUsedCallback)(GDExtensionTypePtr p_packed_string_array);407408/* Method */409410typedef enum {411GDEXTENSION_METHOD_FLAG_NORMAL = 1,412GDEXTENSION_METHOD_FLAG_EDITOR = 2,413GDEXTENSION_METHOD_FLAG_CONST = 4,414GDEXTENSION_METHOD_FLAG_VIRTUAL = 8,415GDEXTENSION_METHOD_FLAG_VARARG = 16,416GDEXTENSION_METHOD_FLAG_STATIC = 32,417GDEXTENSION_METHOD_FLAGS_DEFAULT = GDEXTENSION_METHOD_FLAG_NORMAL,418} GDExtensionClassMethodFlags;419420typedef enum {421GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE,422GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8,423GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16,424GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32,425GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64,426GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8,427GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16,428GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32,429GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64,430GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT,431GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE,432GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR16,433GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_CHAR32,434} GDExtensionClassMethodArgumentMetadata;435436typedef void (*GDExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);437typedef void (*GDExtensionClassMethodValidatedCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionVariantPtr r_return);438typedef void (*GDExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);439440typedef struct {441GDExtensionStringNamePtr name;442void *method_userdata;443GDExtensionClassMethodCall call_func;444GDExtensionClassMethodPtrCall ptrcall_func;445uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`.446447/* If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored.448*449* @todo Consider dropping `has_return_value` and making the other two properties match `GDExtensionMethodInfo` and `GDExtensionClassVirtualMethod` for consistency in future version of this struct.450*/451GDExtensionBool has_return_value;452GDExtensionPropertyInfo *return_value_info;453GDExtensionClassMethodArgumentMetadata return_value_metadata;454455/* Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`.456* Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies.457*458* @todo Consider renaming `arguments_info` to `arguments` for consistency in future version of this struct.459*/460uint32_t argument_count;461GDExtensionPropertyInfo *arguments_info;462GDExtensionClassMethodArgumentMetadata *arguments_metadata;463464/* Default arguments: `default_arguments` is an array of size `default_argument_count`. */465uint32_t default_argument_count;466GDExtensionVariantPtr *default_arguments;467} GDExtensionClassMethodInfo;468469typedef struct {470GDExtensionStringNamePtr name;471uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`.472473GDExtensionPropertyInfo return_value;474GDExtensionClassMethodArgumentMetadata return_value_metadata;475476uint32_t argument_count;477GDExtensionPropertyInfo *arguments;478GDExtensionClassMethodArgumentMetadata *arguments_metadata;479} GDExtensionClassVirtualMethodInfo;480481typedef void (*GDExtensionCallableCustomCall)(void *callable_userdata, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);482typedef GDExtensionBool (*GDExtensionCallableCustomIsValid)(void *callable_userdata);483typedef void (*GDExtensionCallableCustomFree)(void *callable_userdata);484485typedef uint32_t (*GDExtensionCallableCustomHash)(void *callable_userdata);486typedef GDExtensionBool (*GDExtensionCallableCustomEqual)(void *callable_userdata_a, void *callable_userdata_b);487typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_userdata_a, void *callable_userdata_b);488489typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);490491typedef GDExtensionInt (*GDExtensionCallableCustomGetArgumentCount)(void *callable_userdata, GDExtensionBool *r_is_valid);492493typedef struct {494/* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.495*496* `token` should point to an address that uniquely identifies the GDExtension (for example, the497* `GDExtensionClassLibraryPtr` passed to the entry symbol function.498*499* `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and500* `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.501*502* The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.503*504* `is_valid_func` is necessary if the validity of the callable can change before destruction.505*506* `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed.507*/508void *callable_userdata;509void *token;510511GDObjectInstanceID object_id;512513GDExtensionCallableCustomCall call_func;514GDExtensionCallableCustomIsValid is_valid_func;515GDExtensionCallableCustomFree free_func;516517GDExtensionCallableCustomHash hash_func;518GDExtensionCallableCustomEqual equal_func;519GDExtensionCallableCustomLessThan less_than_func;520521GDExtensionCallableCustomToString to_string_func;522} GDExtensionCallableCustomInfo; // Deprecated. Use GDExtensionCallableCustomInfo2 instead.523524typedef struct {525/* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.526*527* `token` should point to an address that uniquely identifies the GDExtension (for example, the528* `GDExtensionClassLibraryPtr` passed to the entry symbol function.529*530* `hash_func`, `equal_func`, and `less_than_func` are optional. If not provided both `call_func` and531* `callable_userdata` together are used as the identity of the callable for hashing and comparison purposes.532*533* The hash returned by `hash_func` is cached, `hash_func` will not be called more than once per callable.534*535* `is_valid_func` is necessary if the validity of the callable can change before destruction.536*537* `free_func` is necessary if `callable_userdata` needs to be cleaned up when the callable is freed.538*/539void *callable_userdata;540void *token;541542GDObjectInstanceID object_id;543544GDExtensionCallableCustomCall call_func;545GDExtensionCallableCustomIsValid is_valid_func;546GDExtensionCallableCustomFree free_func;547548GDExtensionCallableCustomHash hash_func;549GDExtensionCallableCustomEqual equal_func;550GDExtensionCallableCustomLessThan less_than_func;551552GDExtensionCallableCustomToString to_string_func;553554GDExtensionCallableCustomGetArgumentCount get_argument_count_func;555} GDExtensionCallableCustomInfo2;556557/* SCRIPT INSTANCE EXTENSION */558559typedef void *GDExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation.560561typedef GDExtensionBool (*GDExtensionScriptInstanceSet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value);562typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);563typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);564typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreePropertyList2 instead.565typedef void (*GDExtensionScriptInstanceFreePropertyList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count);566typedef GDExtensionBool (*GDExtensionScriptInstanceGetClassCategory)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_class_category);567568typedef GDExtensionVariantType (*GDExtensionScriptInstanceGetPropertyType)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);569typedef GDExtensionBool (*GDExtensionScriptInstanceValidateProperty)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_property);570571typedef GDExtensionBool (*GDExtensionScriptInstancePropertyCanRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);572typedef GDExtensionBool (*GDExtensionScriptInstancePropertyGetRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);573574typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetOwner)(GDExtensionScriptInstanceDataPtr p_instance);575typedef void (*GDExtensionScriptInstancePropertyStateAdd)(GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value, void *p_userdata);576typedef void (*GDExtensionScriptInstanceGetPropertyState)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata);577578typedef const GDExtensionMethodInfo *(*GDExtensionScriptInstanceGetMethodList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);579typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list); // Deprecated. Use GDExtensionScriptInstanceFreeMethodList2 instead.580typedef void (*GDExtensionScriptInstanceFreeMethodList2)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list, uint32_t p_count);581582typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name);583584typedef GDExtensionInt (*GDExtensionScriptInstanceGetMethodArgumentCount)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);585586typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error);587typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead.588typedef void (*GDExtensionScriptInstanceNotification2)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what, GDExtensionBool p_reversed);589typedef void (*GDExtensionScriptInstanceToString)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);590591typedef void (*GDExtensionScriptInstanceRefCountIncremented)(GDExtensionScriptInstanceDataPtr p_instance);592typedef GDExtensionBool (*GDExtensionScriptInstanceRefCountDecremented)(GDExtensionScriptInstanceDataPtr p_instance);593594typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetScript)(GDExtensionScriptInstanceDataPtr p_instance);595typedef GDExtensionBool (*GDExtensionScriptInstanceIsPlaceholder)(GDExtensionScriptInstanceDataPtr p_instance);596597typedef void *GDExtensionScriptLanguagePtr;598599typedef GDExtensionScriptLanguagePtr (*GDExtensionScriptInstanceGetLanguage)(GDExtensionScriptInstanceDataPtr p_instance);600601typedef void (*GDExtensionScriptInstanceFree)(GDExtensionScriptInstanceDataPtr p_instance);602603typedef void *GDExtensionScriptInstancePtr; // Pointer to ScriptInstance.604605typedef struct {606GDExtensionScriptInstanceSet set_func;607GDExtensionScriptInstanceGet get_func;608GDExtensionScriptInstanceGetPropertyList get_property_list_func;609GDExtensionScriptInstanceFreePropertyList free_property_list_func;610611GDExtensionScriptInstancePropertyCanRevert property_can_revert_func;612GDExtensionScriptInstancePropertyGetRevert property_get_revert_func;613614GDExtensionScriptInstanceGetOwner get_owner_func;615GDExtensionScriptInstanceGetPropertyState get_property_state_func;616617GDExtensionScriptInstanceGetMethodList get_method_list_func;618GDExtensionScriptInstanceFreeMethodList free_method_list_func;619GDExtensionScriptInstanceGetPropertyType get_property_type_func;620621GDExtensionScriptInstanceHasMethod has_method_func;622623GDExtensionScriptInstanceCall call_func;624GDExtensionScriptInstanceNotification notification_func;625626GDExtensionScriptInstanceToString to_string_func;627628GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func;629GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func;630631GDExtensionScriptInstanceGetScript get_script_func;632633GDExtensionScriptInstanceIsPlaceholder is_placeholder_func;634635GDExtensionScriptInstanceSet set_fallback_func;636GDExtensionScriptInstanceGet get_fallback_func;637638GDExtensionScriptInstanceGetLanguage get_language_func;639640GDExtensionScriptInstanceFree free_func;641642} GDExtensionScriptInstanceInfo; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead.643644typedef struct {645GDExtensionScriptInstanceSet set_func;646GDExtensionScriptInstanceGet get_func;647GDExtensionScriptInstanceGetPropertyList get_property_list_func;648GDExtensionScriptInstanceFreePropertyList free_property_list_func;649GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior.650651GDExtensionScriptInstancePropertyCanRevert property_can_revert_func;652GDExtensionScriptInstancePropertyGetRevert property_get_revert_func;653654GDExtensionScriptInstanceGetOwner get_owner_func;655GDExtensionScriptInstanceGetPropertyState get_property_state_func;656657GDExtensionScriptInstanceGetMethodList get_method_list_func;658GDExtensionScriptInstanceFreeMethodList free_method_list_func;659GDExtensionScriptInstanceGetPropertyType get_property_type_func;660GDExtensionScriptInstanceValidateProperty validate_property_func;661662GDExtensionScriptInstanceHasMethod has_method_func;663664GDExtensionScriptInstanceCall call_func;665GDExtensionScriptInstanceNotification2 notification_func;666667GDExtensionScriptInstanceToString to_string_func;668669GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func;670GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func;671672GDExtensionScriptInstanceGetScript get_script_func;673674GDExtensionScriptInstanceIsPlaceholder is_placeholder_func;675676GDExtensionScriptInstanceSet set_fallback_func;677GDExtensionScriptInstanceGet get_fallback_func;678679GDExtensionScriptInstanceGetLanguage get_language_func;680681GDExtensionScriptInstanceFree free_func;682683} GDExtensionScriptInstanceInfo2; // Deprecated. Use GDExtensionScriptInstanceInfo3 instead.684685typedef struct {686GDExtensionScriptInstanceSet set_func;687GDExtensionScriptInstanceGet get_func;688GDExtensionScriptInstanceGetPropertyList get_property_list_func;689GDExtensionScriptInstanceFreePropertyList2 free_property_list_func;690GDExtensionScriptInstanceGetClassCategory get_class_category_func; // Optional. Set to NULL for the default behavior.691692GDExtensionScriptInstancePropertyCanRevert property_can_revert_func;693GDExtensionScriptInstancePropertyGetRevert property_get_revert_func;694695GDExtensionScriptInstanceGetOwner get_owner_func;696GDExtensionScriptInstanceGetPropertyState get_property_state_func;697698GDExtensionScriptInstanceGetMethodList get_method_list_func;699GDExtensionScriptInstanceFreeMethodList2 free_method_list_func;700GDExtensionScriptInstanceGetPropertyType get_property_type_func;701GDExtensionScriptInstanceValidateProperty validate_property_func;702703GDExtensionScriptInstanceHasMethod has_method_func;704705GDExtensionScriptInstanceGetMethodArgumentCount get_method_argument_count_func;706707GDExtensionScriptInstanceCall call_func;708GDExtensionScriptInstanceNotification2 notification_func;709710GDExtensionScriptInstanceToString to_string_func;711712GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func;713GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func;714715GDExtensionScriptInstanceGetScript get_script_func;716717GDExtensionScriptInstanceIsPlaceholder is_placeholder_func;718719GDExtensionScriptInstanceSet set_fallback_func;720GDExtensionScriptInstanceGet get_fallback_func;721722GDExtensionScriptInstanceGetLanguage get_language_func;723724GDExtensionScriptInstanceFree free_func;725726} GDExtensionScriptInstanceInfo3;727728typedef void (*GDExtensionWorkerThreadPoolGroupTask)(void *, uint32_t);729typedef void (*GDExtensionWorkerThreadPoolTask)(void *);730731/* INITIALIZATION */732733typedef enum {734GDEXTENSION_INITIALIZATION_CORE,735GDEXTENSION_INITIALIZATION_SERVERS,736GDEXTENSION_INITIALIZATION_SCENE,737GDEXTENSION_INITIALIZATION_EDITOR,738GDEXTENSION_MAX_INITIALIZATION_LEVEL,739} GDExtensionInitializationLevel;740741typedef void (*GDExtensionInitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level);742typedef void (*GDExtensionDeinitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level);743744typedef struct {745/* Minimum initialization level required.746* If Core or Servers, the extension needs editor or game restart to take effect */747GDExtensionInitializationLevel minimum_initialization_level;748/* Up to the user to supply when initializing */749void *userdata;750/* This function will be called multiple times for each initialization level. */751GDExtensionInitializeCallback initialize;752GDExtensionDeinitializeCallback deinitialize;753} GDExtensionInitialization;754755typedef void (*GDExtensionInterfaceFunctionPtr)();756typedef GDExtensionInterfaceFunctionPtr (*GDExtensionInterfaceGetProcAddress)(const char *p_function_name);757758/*759* Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction,760* and export it so that it can be loaded via dlopen() or equivalent for the given platform.761*762* For example:763*764* GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);765*766* This function's name must be specified as the 'entry_symbol' in the .gdextension file.767*768* This makes it the entry point of the GDExtension and will be called on initialization.769*770* The GDExtension can then modify the r_initialization structure, setting the minimum initialization level,771* and providing pointers to functions that will be called at various stages of initialization/shutdown.772*773* The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded774* by calling p_get_proc_address("...") with the name of the function.775*776* For example:777*778* GDExtensionInterfaceGetGodotVersion get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address("get_godot_version");779*780* (Note that snippet may cause "cast between incompatible function types" on some compilers, you can781* silence this by adding an intermediary `void*` cast.)782*783* You can then call it like a normal function:784*785* GDExtensionGodotVersion godot_version;786* get_godot_version(&godot_version);787* printf("Godot v%d.%d.%d\n", godot_version.major, godot_version.minor, godot_version.patch);788*789* All of these interface functions are described below, together with the name that's used to load it,790* and the function pointer typedef that shows its signature.791*/792typedef GDExtensionBool (*GDExtensionInitializationFunction)(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);793794/* INTERFACE */795796typedef struct {797uint32_t major;798uint32_t minor;799uint32_t patch;800const char *string;801} GDExtensionGodotVersion;802803typedef struct {804uint32_t major;805uint32_t minor;806uint32_t patch;807uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C)808const char *status; // (e.g. "stable", "beta", "rc1", "rc2")809const char *build; // (e.g. "custom_build")810const char *hash; // Full Git commit hash.811uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable.812const char *string; // (e.g. "Godot v3.1.4.stable.official.mono")813} GDExtensionGodotVersion2;814815/* Called when starting the main loop. */816typedef void (*GDExtensionMainLoopStartupCallback)();817818/* Called when shutting down the main loop. */819typedef void (*GDExtensionMainLoopShutdownCallback)();820821/* Called for every frame iteration of the main loop. */822typedef void (*GDExtensionMainLoopFrameCallback)();823824typedef struct {825// Will be called after Godot is started and is fully initialized.826GDExtensionMainLoopStartupCallback startup_func;827// Will be called before Godot is shutdown when it is still fully initialized.828GDExtensionMainLoopShutdownCallback shutdown_func;829// Will be called for each process frame. This will run after all `_process()` methods on Node, and before `ScriptServer::frame()`.830// This is intended to be the equivalent of `ScriptLanguage::frame()` for GDExtension language bindings that don't use the script API.831GDExtensionMainLoopFrameCallback frame_func;832} GDExtensionMainLoopCallbacks;833834/**835* @name get_godot_version836* @since 4.1837* @deprecated in Godot 4.5. Use `get_godot_version2` instead.838*839* Gets the Godot version that the GDExtension was loaded into.840*841* @param r_godot_version A pointer to the structure to write the version information into.842*/843typedef void (*GDExtensionInterfaceGetGodotVersion)(GDExtensionGodotVersion *r_godot_version);844845/**846* @name get_godot_version2847* @since 4.5848*849* Gets the Godot version that the GDExtension was loaded into.850*851* @param r_godot_version A pointer to the structure to write the version information into.852*/853typedef void (*GDExtensionInterfaceGetGodotVersion2)(GDExtensionGodotVersion2 *r_godot_version);854855/* INTERFACE: Memory */856857/**858* @name mem_alloc859* @since 4.1860*861* Allocates memory.862*863* @param p_bytes The amount of memory to allocate in bytes.864*865* @return A pointer to the allocated memory, or NULL if unsuccessful.866*/867typedef void *(*GDExtensionInterfaceMemAlloc)(size_t p_bytes);868869/**870* @name mem_realloc871* @since 4.1872*873* Reallocates memory.874*875* @param p_ptr A pointer to the previously allocated memory.876* @param p_bytes The number of bytes to resize the memory block to.877*878* @return A pointer to the allocated memory, or NULL if unsuccessful.879*/880typedef void *(*GDExtensionInterfaceMemRealloc)(void *p_ptr, size_t p_bytes);881882/**883* @name mem_free884* @since 4.1885*886* Frees memory.887*888* @param p_ptr A pointer to the previously allocated memory.889*/890typedef void (*GDExtensionInterfaceMemFree)(void *p_ptr);891892/* INTERFACE: Godot Core */893894/**895* @name print_error896* @since 4.1897*898* Logs an error to Godot's built-in debugger and to the OS terminal.899*900* @param p_description The code triggering the error.901* @param p_function The function name where the error occurred.902* @param p_file The file where the error occurred.903* @param p_line The line where the error occurred.904* @param p_editor_notify Whether or not to notify the editor.905*/906typedef void (*GDExtensionInterfacePrintError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);907908/**909* @name print_error_with_message910* @since 4.1911*912* Logs an error with a message to Godot's built-in debugger and to the OS terminal.913*914* @param p_description The code triggering the error.915* @param p_message The message to show along with the error.916* @param p_function The function name where the error occurred.917* @param p_file The file where the error occurred.918* @param p_line The line where the error occurred.919* @param p_editor_notify Whether or not to notify the editor.920*/921typedef void (*GDExtensionInterfacePrintErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);922923/**924* @name print_warning925* @since 4.1926*927* Logs a warning to Godot's built-in debugger and to the OS terminal.928*929* @param p_description The code triggering the warning.930* @param p_function The function name where the warning occurred.931* @param p_file The file where the warning occurred.932* @param p_line The line where the warning occurred.933* @param p_editor_notify Whether or not to notify the editor.934*/935typedef void (*GDExtensionInterfacePrintWarning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);936937/**938* @name print_warning_with_message939* @since 4.1940*941* Logs a warning with a message to Godot's built-in debugger and to the OS terminal.942*943* @param p_description The code triggering the warning.944* @param p_message The message to show along with the warning.945* @param p_function The function name where the warning occurred.946* @param p_file The file where the warning occurred.947* @param p_line The line where the warning occurred.948* @param p_editor_notify Whether or not to notify the editor.949*/950typedef void (*GDExtensionInterfacePrintWarningWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);951952/**953* @name print_script_error954* @since 4.1955*956* Logs a script error to Godot's built-in debugger and to the OS terminal.957*958* @param p_description The code triggering the error.959* @param p_function The function name where the error occurred.960* @param p_file The file where the error occurred.961* @param p_line The line where the error occurred.962* @param p_editor_notify Whether or not to notify the editor.963*/964typedef void (*GDExtensionInterfacePrintScriptError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);965966/**967* @name print_script_error_with_message968* @since 4.1969*970* Logs a script error with a message to Godot's built-in debugger and to the OS terminal.971*972* @param p_description The code triggering the error.973* @param p_message The message to show along with the error.974* @param p_function The function name where the error occurred.975* @param p_file The file where the error occurred.976* @param p_line The line where the error occurred.977* @param p_editor_notify Whether or not to notify the editor.978*/979typedef void (*GDExtensionInterfacePrintScriptErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify);980981/**982* @name get_native_struct_size983* @since 4.1984*985* Gets the size of a native struct (ex. ObjectID) in bytes.986*987* @param p_name A pointer to a StringName identifying the struct name.988*989* @return The size in bytes.990*/991typedef uint64_t (*GDExtensionInterfaceGetNativeStructSize)(GDExtensionConstStringNamePtr p_name);992993/* INTERFACE: Variant */994995/**996* @name variant_new_copy997* @since 4.1998*999* Copies one Variant into a another.1000*1001* @param r_dest A pointer to the destination Variant.1002* @param p_src A pointer to the source Variant.1003*/1004typedef void (*GDExtensionInterfaceVariantNewCopy)(GDExtensionUninitializedVariantPtr r_dest, GDExtensionConstVariantPtr p_src);10051006/**1007* @name variant_new_nil1008* @since 4.11009*1010* Creates a new Variant containing nil.1011*1012* @param r_dest A pointer to the destination Variant.1013*/1014typedef void (*GDExtensionInterfaceVariantNewNil)(GDExtensionUninitializedVariantPtr r_dest);10151016/**1017* @name variant_destroy1018* @since 4.11019*1020* Destroys a Variant.1021*1022* @param p_self A pointer to the Variant to destroy.1023*/1024typedef void (*GDExtensionInterfaceVariantDestroy)(GDExtensionVariantPtr p_self);10251026/**1027* @name variant_call1028* @since 4.11029*1030* Calls a method on a Variant.1031*1032* @param p_self A pointer to the Variant.1033* @param p_method A pointer to a StringName identifying the method.1034* @param p_args A pointer to a C array of Variant.1035* @param p_argument_count The number of arguments.1036* @param r_return A pointer a Variant which will be assigned the return value.1037* @param r_error A pointer the structure which will hold error information.1038*1039* @see Variant::callp()1040*/1041typedef void (*GDExtensionInterfaceVariantCall)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error);10421043/**1044* @name variant_call_static1045* @since 4.11046*1047* Calls a static method on a Variant.1048*1049* @param p_type The variant type.1050* @param p_method A pointer to a StringName identifying the method.1051* @param p_args A pointer to a C array of Variant.1052* @param p_argument_count The number of arguments.1053* @param r_return A pointer a Variant which will be assigned the return value.1054* @param r_error A pointer the structure which will be updated with error information.1055*1056* @see Variant::call_static()1057*/1058typedef void (*GDExtensionInterfaceVariantCallStatic)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error);10591060/**1061* @name variant_evaluate1062* @since 4.11063*1064* Evaluate an operator on two Variants.1065*1066* @param p_op The operator to evaluate.1067* @param p_a The first Variant.1068* @param p_b The second Variant.1069* @param r_return A pointer a Variant which will be assigned the return value.1070* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1071*1072* @see Variant::evaluate()1073*/1074typedef void (*GDExtensionInterfaceVariantEvaluate)(GDExtensionVariantOperator p_op, GDExtensionConstVariantPtr p_a, GDExtensionConstVariantPtr p_b, GDExtensionUninitializedVariantPtr r_return, GDExtensionBool *r_valid);10751076/**1077* @name variant_set1078* @since 4.11079*1080* Sets a key on a Variant to a value.1081*1082* @param p_self A pointer to the Variant.1083* @param p_key A pointer to a Variant representing the key.1084* @param p_value A pointer to a Variant representing the value.1085* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1086*1087* @see Variant::set()1088*/1089typedef void (*GDExtensionInterfaceVariantSet)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);10901091/**1092* @name variant_set_named1093* @since 4.11094*1095* Sets a named key on a Variant to a value.1096*1097* @param p_self A pointer to the Variant.1098* @param p_key A pointer to a StringName representing the key.1099* @param p_value A pointer to a Variant representing the value.1100* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1101*1102* @see Variant::set_named()1103*/1104typedef void (*GDExtensionInterfaceVariantSetNamed)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);11051106/**1107* @name variant_set_keyed1108* @since 4.11109*1110* Sets a keyed property on a Variant to a value.1111*1112* @param p_self A pointer to the Variant.1113* @param p_key A pointer to a Variant representing the key.1114* @param p_value A pointer to a Variant representing the value.1115* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1116*1117* @see Variant::set_keyed()1118*/1119typedef void (*GDExtensionInterfaceVariantSetKeyed)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid);11201121/**1122* @name variant_set_indexed1123* @since 4.11124*1125* Sets an index on a Variant to a value.1126*1127* @param p_self A pointer to the Variant.1128* @param p_index The index.1129* @param p_value A pointer to a Variant representing the value.1130* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1131* @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds.1132*/1133typedef void (*GDExtensionInterfaceVariantSetIndexed)(GDExtensionVariantPtr p_self, GDExtensionInt p_index, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid, GDExtensionBool *r_oob);11341135/**1136* @name variant_get1137* @since 4.11138*1139* Gets the value of a key from a Variant.1140*1141* @param p_self A pointer to the Variant.1142* @param p_key A pointer to a Variant representing the key.1143* @param r_ret A pointer to a Variant which will be assigned the value.1144* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1145*/1146typedef void (*GDExtensionInterfaceVariantGet)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid);11471148/**1149* @name variant_get_named1150* @since 4.11151*1152* Gets the value of a named key from a Variant.1153*1154* @param p_self A pointer to the Variant.1155* @param p_key A pointer to a StringName representing the key.1156* @param r_ret A pointer to a Variant which will be assigned the value.1157* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1158*/1159typedef void (*GDExtensionInterfaceVariantGetNamed)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid);11601161/**1162* @name variant_get_keyed1163* @since 4.11164*1165* Gets the value of a keyed property from a Variant.1166*1167* @param p_self A pointer to the Variant.1168* @param p_key A pointer to a Variant representing the key.1169* @param r_ret A pointer to a Variant which will be assigned the value.1170* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1171*/1172typedef void (*GDExtensionInterfaceVariantGetKeyed)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid);11731174/**1175* @name variant_get_indexed1176* @since 4.11177*1178* Gets the value of an index from a Variant.1179*1180* @param p_self A pointer to the Variant.1181* @param p_index The index.1182* @param r_ret A pointer to a Variant which will be assigned the value.1183* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1184* @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds.1185*/1186typedef void (*GDExtensionInterfaceVariantGetIndexed)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_index, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid, GDExtensionBool *r_oob);11871188/**1189* @name variant_iter_init1190* @since 4.11191*1192* Initializes an iterator over a Variant.1193*1194* @param p_self A pointer to the Variant.1195* @param r_iter A pointer to a Variant which will be assigned the iterator.1196* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1197*1198* @return true if the operation is valid; otherwise false.1199*1200* @see Variant::iter_init()1201*/1202typedef GDExtensionBool (*GDExtensionInterfaceVariantIterInit)(GDExtensionConstVariantPtr p_self, GDExtensionUninitializedVariantPtr r_iter, GDExtensionBool *r_valid);12031204/**1205* @name variant_iter_next1206* @since 4.11207*1208* Gets the next value for an iterator over a Variant.1209*1210* @param p_self A pointer to the Variant.1211* @param r_iter A pointer to a Variant which will be assigned the iterator.1212* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1213*1214* @return true if the operation is valid; otherwise false.1215*1216* @see Variant::iter_next()1217*/1218typedef GDExtensionBool (*GDExtensionInterfaceVariantIterNext)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionBool *r_valid);12191220/**1221* @name variant_iter_get1222* @since 4.11223*1224* Gets the next value for an iterator over a Variant.1225*1226* @param p_self A pointer to the Variant.1227* @param r_iter A pointer to a Variant which will be assigned the iterator.1228* @param r_ret A pointer to a Variant which will be assigned false if the operation is invalid.1229* @param r_valid A pointer to a boolean which will be set to false if the operation is invalid.1230*1231* @see Variant::iter_get()1232*/1233typedef void (*GDExtensionInterfaceVariantIterGet)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid);12341235/**1236* @name variant_hash1237* @since 4.11238*1239* Gets the hash of a Variant.1240*1241* @param p_self A pointer to the Variant.1242*1243* @return The hash value.1244*1245* @see Variant::hash()1246*/1247typedef GDExtensionInt (*GDExtensionInterfaceVariantHash)(GDExtensionConstVariantPtr p_self);12481249/**1250* @name variant_recursive_hash1251* @since 4.11252*1253* Gets the recursive hash of a Variant.1254*1255* @param p_self A pointer to the Variant.1256* @param p_recursion_count The number of recursive loops so far.1257*1258* @return The hash value.1259*1260* @see Variant::recursive_hash()1261*/1262typedef GDExtensionInt (*GDExtensionInterfaceVariantRecursiveHash)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_recursion_count);12631264/**1265* @name variant_hash_compare1266* @since 4.11267*1268* Compares two Variants by their hash.1269*1270* @param p_self A pointer to the Variant.1271* @param p_other A pointer to the other Variant to compare it to.1272*1273* @return The hash value.1274*1275* @see Variant::hash_compare()1276*/1277typedef GDExtensionBool (*GDExtensionInterfaceVariantHashCompare)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_other);12781279/**1280* @name variant_booleanize1281* @since 4.11282*1283* Converts a Variant to a boolean.1284*1285* @param p_self A pointer to the Variant.1286*1287* @return The boolean value of the Variant.1288*/1289typedef GDExtensionBool (*GDExtensionInterfaceVariantBooleanize)(GDExtensionConstVariantPtr p_self);12901291/**1292* @name variant_duplicate1293* @since 4.11294*1295* Duplicates a Variant.1296*1297* @param p_self A pointer to the Variant.1298* @param r_ret A pointer to a Variant to store the duplicated value.1299* @param p_deep Whether or not to duplicate deeply (when supported by the Variant type).1300*/1301typedef void (*GDExtensionInterfaceVariantDuplicate)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_ret, GDExtensionBool p_deep);13021303/**1304* @name variant_stringify1305* @since 4.11306*1307* Converts a Variant to a string.1308*1309* @param p_self A pointer to the Variant.1310* @param r_ret A pointer to a String to store the resulting value.1311*/1312typedef void (*GDExtensionInterfaceVariantStringify)(GDExtensionConstVariantPtr p_self, GDExtensionStringPtr r_ret);13131314/**1315* @name variant_get_type1316* @since 4.11317*1318* Gets the type of a Variant.1319*1320* @param p_self A pointer to the Variant.1321*1322* @return The variant type.1323*/1324typedef GDExtensionVariantType (*GDExtensionInterfaceVariantGetType)(GDExtensionConstVariantPtr p_self);13251326/**1327* @name variant_has_method1328* @since 4.11329*1330* Checks if a Variant has the given method.1331*1332* @param p_self A pointer to the Variant.1333* @param p_method A pointer to a StringName with the method name.1334*1335* @return true if the variant has the given method; otherwise false.1336*/1337typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMethod)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_method);13381339/**1340* @name variant_has_member1341* @since 4.11342*1343* Checks if a type of Variant has the given member.1344*1345* @param p_type The Variant type.1346* @param p_member A pointer to a StringName with the member name.1347*1348* @return true if the variant has the given method; otherwise false.1349*/1350typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMember)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);13511352/**1353* @name variant_has_key1354* @since 4.11355*1356* Checks if a Variant has a key.1357*1358* @param p_self A pointer to the Variant.1359* @param p_key A pointer to a Variant representing the key.1360* @param r_valid A pointer to a boolean which will be set to false if the key doesn't exist.1361*1362* @return true if the key exists; otherwise false.1363*/1364typedef GDExtensionBool (*GDExtensionInterfaceVariantHasKey)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionBool *r_valid);13651366/**1367* @name variant_get_object_instance_id1368* @since 4.41369*1370* Gets the object instance ID from a variant of type GDEXTENSION_VARIANT_TYPE_OBJECT.1371*1372* If the variant isn't of type GDEXTENSION_VARIANT_TYPE_OBJECT, then zero will be returned.1373* The instance ID will be returned even if the object is no longer valid - use `object_get_instance_by_id()` to check if the object is still valid.1374*1375* @param p_self A pointer to the Variant.1376*1377* @return The instance ID for the contained object.1378*/1379typedef GDObjectInstanceID (*GDExtensionInterfaceVariantGetObjectInstanceId)(GDExtensionConstVariantPtr p_self);13801381/**1382* @name variant_get_type_name1383* @since 4.11384*1385* Gets the name of a Variant type.1386*1387* @param p_type The Variant type.1388* @param r_name A pointer to a String to store the Variant type name.1389*/1390typedef void (*GDExtensionInterfaceVariantGetTypeName)(GDExtensionVariantType p_type, GDExtensionUninitializedStringPtr r_name);13911392/**1393* @name variant_can_convert1394* @since 4.11395*1396* Checks if Variants can be converted from one type to another.1397*1398* @param p_from The Variant type to convert from.1399* @param p_to The Variant type to convert to.1400*1401* @return true if the conversion is possible; otherwise false.1402*/1403typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvert)(GDExtensionVariantType p_from, GDExtensionVariantType p_to);14041405/**1406* @name variant_can_convert_strict1407* @since 4.11408*1409* Checks if Variant can be converted from one type to another using stricter rules.1410*1411* @param p_from The Variant type to convert from.1412* @param p_to The Variant type to convert to.1413*1414* @return true if the conversion is possible; otherwise false.1415*/1416typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvertStrict)(GDExtensionVariantType p_from, GDExtensionVariantType p_to);14171418/**1419* @name get_variant_from_type_constructor1420* @since 4.11421*1422* Gets a pointer to a function that can create a Variant of the given type from a raw value.1423*1424* @param p_type The Variant type.1425*1426* @return A pointer to a function that can create a Variant of the given type from a raw value.1427*/1428typedef GDExtensionVariantFromTypeConstructorFunc (*GDExtensionInterfaceGetVariantFromTypeConstructor)(GDExtensionVariantType p_type);14291430/**1431* @name get_variant_to_type_constructor1432* @since 4.11433*1434* Gets a pointer to a function that can get the raw value from a Variant of the given type.1435*1436* @param p_type The Variant type.1437*1438* @return A pointer to a function that can get the raw value from a Variant of the given type.1439*/1440typedef GDExtensionTypeFromVariantConstructorFunc (*GDExtensionInterfaceGetVariantToTypeConstructor)(GDExtensionVariantType p_type);14411442/**1443* @name variant_get_ptr_internal_getter1444* @since 4.41445*1446* Provides a function pointer for retrieving a pointer to a variant's internal value.1447* Access to a variant's internal value can be used to modify it in-place, or to retrieve its value without the overhead of variant conversion functions.1448* It is recommended to cache the getter for all variant types in a function table to avoid retrieval overhead upon use.1449*1450* @note Each function assumes the variant's type has already been determined and matches the function.1451* Invoking the function with a variant of a mismatched type has undefined behavior, and may lead to a segmentation fault.1452*1453* @param p_type The Variant type.1454*1455* @return A pointer to a type-specific function that returns a pointer to the internal value of a variant. Check the implementation of this function (gdextension_variant_get_ptr_internal_getter) for pointee type info of each variant type.1456*/1457typedef GDExtensionVariantGetInternalPtrFunc (*GDExtensionInterfaceGetVariantGetInternalPtrFunc)(GDExtensionVariantType p_type);14581459/**1460* @name variant_get_ptr_operator_evaluator1461* @since 4.11462*1463* Gets a pointer to a function that can evaluate the given Variant operator on the given Variant types.1464*1465* @param p_operator The variant operator.1466* @param p_type_a The type of the first Variant.1467* @param p_type_b The type of the second Variant.1468*1469* @return A pointer to a function that can evaluate the given Variant operator on the given Variant types.1470*/1471typedef GDExtensionPtrOperatorEvaluator (*GDExtensionInterfaceVariantGetPtrOperatorEvaluator)(GDExtensionVariantOperator p_operator, GDExtensionVariantType p_type_a, GDExtensionVariantType p_type_b);14721473/**1474* @name variant_get_ptr_builtin_method1475* @since 4.11476*1477* Gets a pointer to a function that can call a builtin method on a type of Variant.1478*1479* @param p_type The Variant type.1480* @param p_method A pointer to a StringName with the method name.1481* @param p_hash A hash representing the method signature.1482*1483* @return A pointer to a function that can call a builtin method on a type of Variant.1484*/1485typedef GDExtensionPtrBuiltInMethod (*GDExtensionInterfaceVariantGetPtrBuiltinMethod)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionInt p_hash);14861487/**1488* @name variant_get_ptr_constructor1489* @since 4.11490*1491* Gets a pointer to a function that can call one of the constructors for a type of Variant.1492*1493* @param p_type The Variant type.1494* @param p_constructor The index of the constructor.1495*1496* @return A pointer to a function that can call one of the constructors for a type of Variant.1497*/1498typedef GDExtensionPtrConstructor (*GDExtensionInterfaceVariantGetPtrConstructor)(GDExtensionVariantType p_type, int32_t p_constructor);14991500/**1501* @name variant_get_ptr_destructor1502* @since 4.11503*1504* Gets a pointer to a function than can call the destructor for a type of Variant.1505*1506* @param p_type The Variant type.1507*1508* @return A pointer to a function than can call the destructor for a type of Variant.1509*/1510typedef GDExtensionPtrDestructor (*GDExtensionInterfaceVariantGetPtrDestructor)(GDExtensionVariantType p_type);15111512/**1513* @name variant_construct1514* @since 4.11515*1516* Constructs a Variant of the given type, using the first constructor that matches the given arguments.1517*1518* @param p_type The Variant type.1519* @param r_base A pointer to a Variant to store the constructed value.1520* @param p_args A pointer to a C array of Variant pointers representing the arguments for the constructor.1521* @param p_argument_count The number of arguments to pass to the constructor.1522* @param r_error A pointer the structure which will be updated with error information.1523*/1524typedef void (*GDExtensionInterfaceVariantConstruct)(GDExtensionVariantType p_type, GDExtensionUninitializedVariantPtr r_base, const GDExtensionConstVariantPtr *p_args, int32_t p_argument_count, GDExtensionCallError *r_error);15251526/**1527* @name variant_get_ptr_setter1528* @since 4.11529*1530* Gets a pointer to a function that can call a member's setter on the given Variant type.1531*1532* @param p_type The Variant type.1533* @param p_member A pointer to a StringName with the member name.1534*1535* @return A pointer to a function that can call a member's setter on the given Variant type.1536*/1537typedef GDExtensionPtrSetter (*GDExtensionInterfaceVariantGetPtrSetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);15381539/**1540* @name variant_get_ptr_getter1541* @since 4.11542*1543* Gets a pointer to a function that can call a member's getter on the given Variant type.1544*1545* @param p_type The Variant type.1546* @param p_member A pointer to a StringName with the member name.1547*1548* @return A pointer to a function that can call a member's getter on the given Variant type.1549*/1550typedef GDExtensionPtrGetter (*GDExtensionInterfaceVariantGetPtrGetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);15511552/**1553* @name variant_get_ptr_indexed_setter1554* @since 4.11555*1556* Gets a pointer to a function that can set an index on the given Variant type.1557*1558* @param p_type The Variant type.1559*1560* @return A pointer to a function that can set an index on the given Variant type.1561*/1562typedef GDExtensionPtrIndexedSetter (*GDExtensionInterfaceVariantGetPtrIndexedSetter)(GDExtensionVariantType p_type);15631564/**1565* @name variant_get_ptr_indexed_getter1566* @since 4.11567*1568* Gets a pointer to a function that can get an index on the given Variant type.1569*1570* @param p_type The Variant type.1571*1572* @return A pointer to a function that can get an index on the given Variant type.1573*/1574typedef GDExtensionPtrIndexedGetter (*GDExtensionInterfaceVariantGetPtrIndexedGetter)(GDExtensionVariantType p_type);15751576/**1577* @name variant_get_ptr_keyed_setter1578* @since 4.11579*1580* Gets a pointer to a function that can set a key on the given Variant type.1581*1582* @param p_type The Variant type.1583*1584* @return A pointer to a function that can set a key on the given Variant type.1585*/1586typedef GDExtensionPtrKeyedSetter (*GDExtensionInterfaceVariantGetPtrKeyedSetter)(GDExtensionVariantType p_type);15871588/**1589* @name variant_get_ptr_keyed_getter1590* @since 4.11591*1592* Gets a pointer to a function that can get a key on the given Variant type.1593*1594* @param p_type The Variant type.1595*1596* @return A pointer to a function that can get a key on the given Variant type.1597*/1598typedef GDExtensionPtrKeyedGetter (*GDExtensionInterfaceVariantGetPtrKeyedGetter)(GDExtensionVariantType p_type);15991600/**1601* @name variant_get_ptr_keyed_checker1602* @since 4.11603*1604* Gets a pointer to a function that can check a key on the given Variant type.1605*1606* @param p_type The Variant type.1607*1608* @return A pointer to a function that can check a key on the given Variant type.1609*/1610typedef GDExtensionPtrKeyedChecker (*GDExtensionInterfaceVariantGetPtrKeyedChecker)(GDExtensionVariantType p_type);16111612/**1613* @name variant_get_constant_value1614* @since 4.11615*1616* Gets the value of a constant from the given Variant type.1617*1618* @param p_type The Variant type.1619* @param p_constant A pointer to a StringName with the constant name.1620* @param r_ret A pointer to a Variant to store the value.1621*/1622typedef void (*GDExtensionInterfaceVariantGetConstantValue)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_constant, GDExtensionUninitializedVariantPtr r_ret);16231624/**1625* @name variant_get_ptr_utility_function1626* @since 4.11627*1628* Gets a pointer to a function that can call a Variant utility function.1629*1630* @param p_function A pointer to a StringName with the function name.1631* @param p_hash A hash representing the function signature.1632*1633* @return A pointer to a function that can call a Variant utility function.1634*/1635typedef GDExtensionPtrUtilityFunction (*GDExtensionInterfaceVariantGetPtrUtilityFunction)(GDExtensionConstStringNamePtr p_function, GDExtensionInt p_hash);16361637/* INTERFACE: String Utilities */16381639/**1640* @name string_new_with_latin1_chars1641* @since 4.11642*1643* Creates a String from a Latin-1 encoded C string.1644*1645* @param r_dest A pointer to a Variant to hold the newly created String.1646* @param p_contents A pointer to a Latin-1 encoded C string (null terminated).1647*/1648typedef void (*GDExtensionInterfaceStringNewWithLatin1Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents);16491650/**1651* @name string_new_with_utf8_chars1652* @since 4.11653*1654* Creates a String from a UTF-8 encoded C string.1655*1656* @param r_dest A pointer to a Variant to hold the newly created String.1657* @param p_contents A pointer to a UTF-8 encoded C string (null terminated).1658*/1659typedef void (*GDExtensionInterfaceStringNewWithUtf8Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents);16601661/**1662* @name string_new_with_utf16_chars1663* @since 4.11664*1665* Creates a String from a UTF-16 encoded C string.1666*1667* @param r_dest A pointer to a Variant to hold the newly created String.1668* @param p_contents A pointer to a UTF-16 encoded C string (null terminated).1669*/1670typedef void (*GDExtensionInterfaceStringNewWithUtf16Chars)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents);16711672/**1673* @name string_new_with_utf32_chars1674* @since 4.11675*1676* Creates a String from a UTF-32 encoded C string.1677*1678* @param r_dest A pointer to a Variant to hold the newly created String.1679* @param p_contents A pointer to a UTF-32 encoded C string (null terminated).1680*/1681typedef void (*GDExtensionInterfaceStringNewWithUtf32Chars)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents);16821683/**1684* @name string_new_with_wide_chars1685* @since 4.11686*1687* Creates a String from a wide C string.1688*1689* @param r_dest A pointer to a Variant to hold the newly created String.1690* @param p_contents A pointer to a wide C string (null terminated).1691*/1692typedef void (*GDExtensionInterfaceStringNewWithWideChars)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents);16931694/**1695* @name string_new_with_latin1_chars_and_len1696* @since 4.11697*1698* Creates a String from a Latin-1 encoded C string with the given length.1699*1700* @param r_dest A pointer to a Variant to hold the newly created String.1701* @param p_contents A pointer to a Latin-1 encoded C string.1702* @param p_size The number of characters (= number of bytes).1703*/1704typedef void (*GDExtensionInterfaceStringNewWithLatin1CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size);17051706/**1707* @name string_new_with_utf8_chars_and_len1708* @since 4.11709* @deprecated in Godot 4.3. Use `string_new_with_utf8_chars_and_len2` instead.1710*1711* Creates a String from a UTF-8 encoded C string with the given length.1712*1713* @param r_dest A pointer to a Variant to hold the newly created String.1714* @param p_contents A pointer to a UTF-8 encoded C string.1715* @param p_size The number of bytes (not code units).1716*/1717typedef void (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size);17181719/**1720* @name string_new_with_utf8_chars_and_len21721* @since 4.31722*1723* Creates a String from a UTF-8 encoded C string with the given length.1724*1725* @param r_dest A pointer to a Variant to hold the newly created String.1726* @param p_contents A pointer to a UTF-8 encoded C string.1727* @param p_size The number of bytes (not code units).1728*1729* @return Error code signifying if the operation successful.1730*/1731typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen2)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size);17321733/**1734* @name string_new_with_utf16_chars_and_len1735* @since 4.11736* @deprecated in Godot 4.3. Use `string_new_with_utf16_chars_and_len2` instead.1737*1738* Creates a String from a UTF-16 encoded C string with the given length.1739*1740* @param r_dest A pointer to a Variant to hold the newly created String.1741* @param p_contents A pointer to a UTF-16 encoded C string.1742* @param p_char_count The number of characters (not bytes).1743*/1744typedef void (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_char_count);17451746/**1747* @name string_new_with_utf16_chars_and_len21748* @since 4.31749*1750* Creates a String from a UTF-16 encoded C string with the given length.1751*1752* @param r_dest A pointer to a Variant to hold the newly created String.1753* @param p_contents A pointer to a UTF-16 encoded C string.1754* @param p_char_count The number of characters (not bytes).1755* @param p_default_little_endian If true, UTF-16 use little endian.1756*1757* @return Error code signifying if the operation successful.1758*/1759typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen2)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_char_count, GDExtensionBool p_default_little_endian);17601761/**1762* @name string_new_with_utf32_chars_and_len1763* @since 4.11764*1765* Creates a String from a UTF-32 encoded C string with the given length.1766*1767* @param r_dest A pointer to a Variant to hold the newly created String.1768* @param p_contents A pointer to a UTF-32 encoded C string.1769* @param p_char_count The number of characters (not bytes).1770*/1771typedef void (*GDExtensionInterfaceStringNewWithUtf32CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_char_count);17721773/**1774* @name string_new_with_wide_chars_and_len1775* @since 4.11776*1777* Creates a String from a wide C string with the given length.1778*1779* @param r_dest A pointer to a Variant to hold the newly created String.1780* @param p_contents A pointer to a wide C string.1781* @param p_char_count The number of characters (not bytes).1782*/1783typedef void (*GDExtensionInterfaceStringNewWithWideCharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_char_count);17841785/**1786* @name string_to_latin1_chars1787* @since 4.11788*1789* Converts a String to a Latin-1 encoded C string.1790*1791* It doesn't write a null terminator.1792*1793* @param p_self A pointer to the String.1794* @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed.1795* @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value.1796*1797* @return The resulting encoded string length in characters (not bytes), not including a null terminator.1798*/1799typedef GDExtensionInt (*GDExtensionInterfaceStringToLatin1Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length);18001801/**1802* @name string_to_utf8_chars1803* @since 4.11804*1805* Converts a String to a UTF-8 encoded C string.1806*1807* It doesn't write a null terminator.1808*1809* @param p_self A pointer to the String.1810* @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed.1811* @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value.1812*1813* @return The resulting encoded string length in characters (not bytes), not including a null terminator.1814*/1815typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf8Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length);18161817/**1818* @name string_to_utf16_chars1819* @since 4.11820*1821* Converts a String to a UTF-16 encoded C string.1822*1823* It doesn't write a null terminator.1824*1825* @param p_self A pointer to the String.1826* @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed.1827* @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value.1828*1829* @return The resulting encoded string length in characters (not bytes), not including a null terminator.1830*/1831typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf16Chars)(GDExtensionConstStringPtr p_self, char16_t *r_text, GDExtensionInt p_max_write_length);18321833/**1834* @name string_to_utf32_chars1835* @since 4.11836*1837* Converts a String to a UTF-32 encoded C string.1838*1839* It doesn't write a null terminator.1840*1841* @param p_self A pointer to the String.1842* @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed.1843* @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value.1844*1845* @return The resulting encoded string length in characters (not bytes), not including a null terminator.1846*/1847typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf32Chars)(GDExtensionConstStringPtr p_self, char32_t *r_text, GDExtensionInt p_max_write_length);18481849/**1850* @name string_to_wide_chars1851* @since 4.11852*1853* Converts a String to a wide C string.1854*1855* It doesn't write a null terminator.1856*1857* @param p_self A pointer to the String.1858* @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed.1859* @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value.1860*1861* @return The resulting encoded string length in characters (not bytes), not including a null terminator.1862*/1863typedef GDExtensionInt (*GDExtensionInterfaceStringToWideChars)(GDExtensionConstStringPtr p_self, wchar_t *r_text, GDExtensionInt p_max_write_length);18641865/**1866* @name string_operator_index1867* @since 4.11868*1869* Gets a pointer to the character at the given index from a String.1870*1871* @param p_self A pointer to the String.1872* @param p_index The index.1873*1874* @return A pointer to the requested character.1875*/1876typedef char32_t *(*GDExtensionInterfaceStringOperatorIndex)(GDExtensionStringPtr p_self, GDExtensionInt p_index);18771878/**1879* @name string_operator_index_const1880* @since 4.11881*1882* Gets a const pointer to the character at the given index from a String.1883*1884* @param p_self A pointer to the String.1885* @param p_index The index.1886*1887* @return A const pointer to the requested character.1888*/1889typedef const char32_t *(*GDExtensionInterfaceStringOperatorIndexConst)(GDExtensionConstStringPtr p_self, GDExtensionInt p_index);18901891/**1892* @name string_operator_plus_eq_string1893* @since 4.11894*1895* Appends another String to a String.1896*1897* @param p_self A pointer to the String.1898* @param p_b A pointer to the other String to append.1899*/1900typedef void (*GDExtensionInterfaceStringOperatorPlusEqString)(GDExtensionStringPtr p_self, GDExtensionConstStringPtr p_b);19011902/**1903* @name string_operator_plus_eq_char1904* @since 4.11905*1906* Appends a character to a String.1907*1908* @param p_self A pointer to the String.1909* @param p_b A pointer to the character to append.1910*/1911typedef void (*GDExtensionInterfaceStringOperatorPlusEqChar)(GDExtensionStringPtr p_self, char32_t p_b);19121913/**1914* @name string_operator_plus_eq_cstr1915* @since 4.11916*1917* Appends a Latin-1 encoded C string to a String.1918*1919* @param p_self A pointer to the String.1920* @param p_b A pointer to a Latin-1 encoded C string (null terminated).1921*/1922typedef void (*GDExtensionInterfaceStringOperatorPlusEqCstr)(GDExtensionStringPtr p_self, const char *p_b);19231924/**1925* @name string_operator_plus_eq_wcstr1926* @since 4.11927*1928* Appends a wide C string to a String.1929*1930* @param p_self A pointer to the String.1931* @param p_b A pointer to a wide C string (null terminated).1932*/1933typedef void (*GDExtensionInterfaceStringOperatorPlusEqWcstr)(GDExtensionStringPtr p_self, const wchar_t *p_b);19341935/**1936* @name string_operator_plus_eq_c32str1937* @since 4.11938*1939* Appends a UTF-32 encoded C string to a String.1940*1941* @param p_self A pointer to the String.1942* @param p_b A pointer to a UTF-32 encoded C string (null terminated).1943*/1944typedef void (*GDExtensionInterfaceStringOperatorPlusEqC32str)(GDExtensionStringPtr p_self, const char32_t *p_b);19451946/**1947* @name string_resize1948* @since 4.21949*1950* Resizes the underlying string data to the given number of characters.1951*1952* Space needs to be allocated for the null terminating character ('\0') which1953* also must be added manually, in order for all string functions to work correctly.1954*1955* Warning: This is an error-prone operation - only use it if there's no other1956* efficient way to accomplish your goal.1957*1958* @param p_self A pointer to the String.1959* @param p_resize The new length for the String.1960*1961* @return Error code signifying if the operation successful.1962*/1963typedef GDExtensionInt (*GDExtensionInterfaceStringResize)(GDExtensionStringPtr p_self, GDExtensionInt p_resize);19641965/* INTERFACE: StringName Utilities */19661967/**1968* @name string_name_new_with_latin1_chars1969* @since 4.21970*1971* Creates a StringName from a Latin-1 encoded C string.1972*1973* If `p_is_static` is true, then:1974* - The StringName will reuse the `p_contents` buffer instead of copying it.1975* You must guarantee that the buffer remains valid for the duration of the application (e.g. string literal).1976* - You must not call a destructor for this StringName. Incrementing the initial reference once should achieve this.1977*1978* `p_is_static` is purely an optimization and can easily introduce undefined behavior if used wrong. In case of doubt, set it to false.1979*1980* @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed.1981* @param p_contents A pointer to a C string (null terminated and Latin-1 or ASCII encoded).1982* @param p_is_static Whether the StringName reuses the buffer directly (see above).1983*/1984typedef void (*GDExtensionInterfaceStringNameNewWithLatin1Chars)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents, GDExtensionBool p_is_static);19851986/**1987* @name string_name_new_with_utf8_chars1988* @since 4.21989*1990* Creates a StringName from a UTF-8 encoded C string.1991*1992* @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed.1993* @param p_contents A pointer to a C string (null terminated and UTF-8 encoded).1994*/1995typedef void (*GDExtensionInterfaceStringNameNewWithUtf8Chars)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents);19961997/**1998* @name string_name_new_with_utf8_chars_and_len1999* @since 4.22000*2001* Creates a StringName from a UTF-8 encoded string with a given number of characters.2002*2003* @param r_dest A pointer to uninitialized storage, into which the newly created StringName is constructed.2004* @param p_contents A pointer to a C string (null terminated and UTF-8 encoded).2005* @param p_size The number of bytes (not UTF-8 code points).2006*/2007typedef void (*GDExtensionInterfaceStringNameNewWithUtf8CharsAndLen)(GDExtensionUninitializedStringNamePtr r_dest, const char *p_contents, GDExtensionInt p_size);20082009/* INTERFACE: XMLParser Utilities */20102011/**2012* @name xml_parser_open_buffer2013* @since 4.12014*2015* Opens a raw XML buffer on an XMLParser instance.2016*2017* @param p_instance A pointer to an XMLParser object.2018* @param p_buffer A pointer to the buffer.2019* @param p_size The size of the buffer.2020*2021* @return A Godot error code (ex. OK, ERR_INVALID_DATA, etc).2022*2023* @see XMLParser::open_buffer()2024*/2025typedef GDExtensionInt (*GDExtensionInterfaceXmlParserOpenBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_buffer, size_t p_size);20262027/* INTERFACE: FileAccess Utilities */20282029/**2030* @name file_access_store_buffer2031* @since 4.12032*2033* Stores the given buffer using an instance of FileAccess.2034*2035* @param p_instance A pointer to a FileAccess object.2036* @param p_src A pointer to the buffer.2037* @param p_length The size of the buffer.2038*2039* @see FileAccess::store_buffer()2040*/2041typedef void (*GDExtensionInterfaceFileAccessStoreBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_src, uint64_t p_length);20422043/**2044* @name file_access_get_buffer2045* @since 4.12046*2047* Reads the next p_length bytes into the given buffer using an instance of FileAccess.2048*2049* @param p_instance A pointer to a FileAccess object.2050* @param p_dst A pointer to the buffer to store the data.2051* @param p_length The requested number of bytes to read.2052*2053* @return The actual number of bytes read (may be less than requested).2054*/2055typedef uint64_t (*GDExtensionInterfaceFileAccessGetBuffer)(GDExtensionConstObjectPtr p_instance, uint8_t *p_dst, uint64_t p_length);20562057/* INTERFACE: Image Utilities */20582059/**2060* @name image_ptrw2061* @since 4.32062*2063* Returns writable pointer to internal Image buffer.2064*2065* @param p_instance A pointer to a Image object.2066*2067* @return Pointer to internal Image buffer.2068*2069* @see Image::ptrw()2070*/2071typedef uint8_t *(*GDExtensionInterfaceImagePtrw)(GDExtensionObjectPtr p_instance);20722073/**2074* @name image_ptr2075* @since 4.32076*2077* Returns read only pointer to internal Image buffer.2078*2079* @param p_instance A pointer to a Image object.2080*2081* @return Pointer to internal Image buffer.2082*2083* @see Image::ptr()2084*/2085typedef const uint8_t *(*GDExtensionInterfaceImagePtr)(GDExtensionObjectPtr p_instance);20862087/* INTERFACE: WorkerThreadPool Utilities */20882089/**2090* @name worker_thread_pool_add_native_group_task2091* @since 4.12092*2093* Adds a group task to an instance of WorkerThreadPool.2094*2095* @param p_instance A pointer to a WorkerThreadPool object.2096* @param p_func A pointer to a function to run in the thread pool.2097* @param p_userdata A pointer to arbitrary data which will be passed to p_func.2098* @param p_elements The number of element needed in the group.2099* @param p_tasks The number of tasks needed in the group.2100* @param p_high_priority Whether or not this is a high priority task.2101* @param p_description A pointer to a String with the task description.2102*2103* @return The task group ID.2104*2105* @see WorkerThreadPool::add_group_task()2106*/2107typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolGroupTask p_func, void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);21082109/**2110* @name worker_thread_pool_add_native_task2111* @since 4.12112*2113* Adds a task to an instance of WorkerThreadPool.2114*2115* @param p_instance A pointer to a WorkerThreadPool object.2116* @param p_func A pointer to a function to run in the thread pool.2117* @param p_userdata A pointer to arbitrary data which will be passed to p_func.2118* @param p_high_priority Whether or not this is a high priority task.2119* @param p_description A pointer to a String with the task description.2120*2121* @return The task ID.2122*/2123typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolTask p_func, void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);21242125/* INTERFACE: Packed Array */21262127/**2128* @name packed_byte_array_operator_index2129* @since 4.12130*2131* Gets a pointer to a byte in a PackedByteArray.2132*2133* @param p_self A pointer to a PackedByteArray object.2134* @param p_index The index of the byte to get.2135*2136* @return A pointer to the requested byte.2137*/2138typedef uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);21392140/**2141* @name packed_byte_array_operator_index_const2142* @since 4.12143*2144* Gets a const pointer to a byte in a PackedByteArray.2145*2146* @param p_self A const pointer to a PackedByteArray object.2147* @param p_index The index of the byte to get.2148*2149* @return A const pointer to the requested byte.2150*/2151typedef const uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);21522153/**2154* @name packed_float32_array_operator_index2155* @since 4.12156*2157* Gets a pointer to a 32-bit float in a PackedFloat32Array.2158*2159* @param p_self A pointer to a PackedFloat32Array object.2160* @param p_index The index of the float to get.2161*2162* @return A pointer to the requested 32-bit float.2163*/2164typedef float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);21652166/**2167* @name packed_float32_array_operator_index_const2168* @since 4.12169*2170* Gets a const pointer to a 32-bit float in a PackedFloat32Array.2171*2172* @param p_self A const pointer to a PackedFloat32Array object.2173* @param p_index The index of the float to get.2174*2175* @return A const pointer to the requested 32-bit float.2176*/2177typedef const float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);21782179/**2180* @name packed_float64_array_operator_index2181* @since 4.12182*2183* Gets a pointer to a 64-bit float in a PackedFloat64Array.2184*2185* @param p_self A pointer to a PackedFloat64Array object.2186* @param p_index The index of the float to get.2187*2188* @return A pointer to the requested 64-bit float.2189*/2190typedef double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);21912192/**2193* @name packed_float64_array_operator_index_const2194* @since 4.12195*2196* Gets a const pointer to a 64-bit float in a PackedFloat64Array.2197*2198* @param p_self A const pointer to a PackedFloat64Array object.2199* @param p_index The index of the float to get.2200*2201* @return A const pointer to the requested 64-bit float.2202*/2203typedef const double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);22042205/**2206* @name packed_int32_array_operator_index2207* @since 4.12208*2209* Gets a pointer to a 32-bit integer in a PackedInt32Array.2210*2211* @param p_self A pointer to a PackedInt32Array object.2212* @param p_index The index of the integer to get.2213*2214* @return A pointer to the requested 32-bit integer.2215*/2216typedef int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);22172218/**2219* @name packed_int32_array_operator_index_const2220* @since 4.12221*2222* Gets a const pointer to a 32-bit integer in a PackedInt32Array.2223*2224* @param p_self A const pointer to a PackedInt32Array object.2225* @param p_index The index of the integer to get.2226*2227* @return A const pointer to the requested 32-bit integer.2228*/2229typedef const int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);22302231/**2232* @name packed_int64_array_operator_index2233* @since 4.12234*2235* Gets a pointer to a 64-bit integer in a PackedInt64Array.2236*2237* @param p_self A pointer to a PackedInt64Array object.2238* @param p_index The index of the integer to get.2239*2240* @return A pointer to the requested 64-bit integer.2241*/2242typedef int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);22432244/**2245* @name packed_int64_array_operator_index_const2246* @since 4.12247*2248* Gets a const pointer to a 64-bit integer in a PackedInt64Array.2249*2250* @param p_self A const pointer to a PackedInt64Array object.2251* @param p_index The index of the integer to get.2252*2253* @return A const pointer to the requested 64-bit integer.2254*/2255typedef const int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);22562257/**2258* @name packed_string_array_operator_index2259* @since 4.12260*2261* Gets a pointer to a string in a PackedStringArray.2262*2263* @param p_self A pointer to a PackedStringArray object.2264* @param p_index The index of the String to get.2265*2266* @return A pointer to the requested String.2267*/2268typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);22692270/**2271* @name packed_string_array_operator_index_const2272* @since 4.12273*2274* Gets a const pointer to a string in a PackedStringArray.2275*2276* @param p_self A const pointer to a PackedStringArray object.2277* @param p_index The index of the String to get.2278*2279* @return A const pointer to the requested String.2280*/2281typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);22822283/**2284* @name packed_vector2_array_operator_index2285* @since 4.12286*2287* Gets a pointer to a Vector2 in a PackedVector2Array.2288*2289* @param p_self A pointer to a PackedVector2Array object.2290* @param p_index The index of the Vector2 to get.2291*2292* @return A pointer to the requested Vector2.2293*/2294typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);22952296/**2297* @name packed_vector2_array_operator_index_const2298* @since 4.12299*2300* Gets a const pointer to a Vector2 in a PackedVector2Array.2301*2302* @param p_self A const pointer to a PackedVector2Array object.2303* @param p_index The index of the Vector2 to get.2304*2305* @return A const pointer to the requested Vector2.2306*/2307typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);23082309/**2310* @name packed_vector3_array_operator_index2311* @since 4.12312*2313* Gets a pointer to a Vector3 in a PackedVector3Array.2314*2315* @param p_self A pointer to a PackedVector3Array object.2316* @param p_index The index of the Vector3 to get.2317*2318* @return A pointer to the requested Vector3.2319*/2320typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);23212322/**2323* @name packed_vector3_array_operator_index_const2324* @since 4.12325*2326* Gets a const pointer to a Vector3 in a PackedVector3Array.2327*2328* @param p_self A const pointer to a PackedVector3Array object.2329* @param p_index The index of the Vector3 to get.2330*2331* @return A const pointer to the requested Vector3.2332*/2333typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);23342335/**2336* @name packed_vector4_array_operator_index2337* @since 4.32338*2339* Gets a pointer to a Vector4 in a PackedVector4Array.2340*2341* @param p_self A pointer to a PackedVector4Array object.2342* @param p_index The index of the Vector4 to get.2343*2344* @return A pointer to the requested Vector4.2345*/2346typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);23472348/**2349* @name packed_vector4_array_operator_index_const2350* @since 4.32351*2352* Gets a const pointer to a Vector4 in a PackedVector4Array.2353*2354* @param p_self A const pointer to a PackedVector4Array object.2355* @param p_index The index of the Vector4 to get.2356*2357* @return A const pointer to the requested Vector4.2358*/2359typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);23602361/**2362* @name packed_color_array_operator_index2363* @since 4.12364*2365* Gets a pointer to a color in a PackedColorArray.2366*2367* @param p_self A pointer to a PackedColorArray object.2368* @param p_index The index of the Color to get.2369*2370* @return A pointer to the requested Color.2371*/2372typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);23732374/**2375* @name packed_color_array_operator_index_const2376* @since 4.12377*2378* Gets a const pointer to a color in a PackedColorArray.2379*2380* @param p_self A const pointer to a PackedColorArray object.2381* @param p_index The index of the Color to get.2382*2383* @return A const pointer to the requested Color.2384*/2385typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);23862387/**2388* @name array_operator_index2389* @since 4.12390*2391* Gets a pointer to a Variant in an Array.2392*2393* @param p_self A pointer to an Array object.2394* @param p_index The index of the Variant to get.2395*2396* @return A pointer to the requested Variant.2397*/2398typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index);23992400/**2401* @name array_operator_index_const2402* @since 4.12403*2404* Gets a const pointer to a Variant in an Array.2405*2406* @param p_self A const pointer to an Array object.2407* @param p_index The index of the Variant to get.2408*2409* @return A const pointer to the requested Variant.2410*/2411typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index);24122413/**2414* @name array_ref2415* @since 4.12416* @deprecated in Godot 4.5. use `Array::operator=` instead.2417*2418* Sets an Array to be a reference to another Array object.2419*2420* @param p_self A pointer to the Array object to update.2421* @param p_from A pointer to the Array object to reference.2422*/2423typedef void (*GDExtensionInterfaceArrayRef)(GDExtensionTypePtr p_self, GDExtensionConstTypePtr p_from);24242425/**2426* @name array_set_typed2427* @since 4.12428*2429* Makes an Array into a typed Array.2430*2431* @param p_self A pointer to the Array.2432* @param p_type The type of Variant the Array will store.2433* @param p_class_name A pointer to a StringName with the name of the object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT).2434* @param p_script A pointer to a Script object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script).2435*/2436typedef void (*GDExtensionInterfaceArraySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script);24372438/* INTERFACE: Dictionary */24392440/**2441* @name dictionary_operator_index2442* @since 4.12443*2444* Gets a pointer to a Variant in a Dictionary with the given key.2445*2446* @param p_self A pointer to a Dictionary object.2447* @param p_key A pointer to a Variant representing the key.2448*2449* @return A pointer to a Variant representing the value at the given key.2450*/2451typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionConstVariantPtr p_key);24522453/**2454* @name dictionary_operator_index_const2455* @since 4.12456*2457* Gets a const pointer to a Variant in a Dictionary with the given key.2458*2459* @param p_self A const pointer to a Dictionary object.2460* @param p_key A pointer to a Variant representing the key.2461*2462* @return A const pointer to a Variant representing the value at the given key.2463*/2464typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionConstVariantPtr p_key);24652466/**2467* @name dictionary_set_typed2468* @since 4.42469*2470* Makes a Dictionary into a typed Dictionary.2471*2472* @param p_self A pointer to the Dictionary.2473* @param p_key_type The type of Variant the Dictionary key will store.2474* @param p_key_class_name A pointer to a StringName with the name of the object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT).2475* @param p_key_script A pointer to a Script object (if p_key_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script).2476* @param p_value_type The type of Variant the Dictionary value will store.2477* @param p_value_class_name A pointer to a StringName with the name of the object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT).2478* @param p_value_script A pointer to a Script object (if p_value_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script).2479*/2480typedef void (*GDExtensionInterfaceDictionarySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_key_type, GDExtensionConstStringNamePtr p_key_class_name, GDExtensionConstVariantPtr p_key_script, GDExtensionVariantType p_value_type, GDExtensionConstStringNamePtr p_value_class_name, GDExtensionConstVariantPtr p_value_script);24812482/* INTERFACE: Object */24832484/**2485* @name object_method_bind_call2486* @since 4.12487*2488* Calls a method on an Object.2489*2490* @param p_method_bind A pointer to the MethodBind representing the method on the Object's class.2491* @param p_instance A pointer to the Object.2492* @param p_args A pointer to a C array of Variants representing the arguments.2493* @param p_arg_count The number of arguments.2494* @param r_ret A pointer to Variant which will receive the return value.2495* @param r_error A pointer to a GDExtensionCallError struct that will receive error information.2496*/2497typedef void (*GDExtensionInterfaceObjectMethodBindCall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionUninitializedVariantPtr r_ret, GDExtensionCallError *r_error);24982499/**2500* @name object_method_bind_ptrcall2501* @since 4.12502*2503* Calls a method on an Object (using a "ptrcall").2504*2505* @param p_method_bind A pointer to the MethodBind representing the method on the Object's class.2506* @param p_instance A pointer to the Object.2507* @param p_args A pointer to a C array representing the arguments.2508* @param r_ret A pointer to the Object that will receive the return value.2509*/2510typedef void (*GDExtensionInterfaceObjectMethodBindPtrcall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret);25112512/**2513* @name object_destroy2514* @since 4.12515*2516* Destroys an Object.2517*2518* @param p_o A pointer to the Object.2519*/2520typedef void (*GDExtensionInterfaceObjectDestroy)(GDExtensionObjectPtr p_o);25212522/**2523* @name global_get_singleton2524* @since 4.12525*2526* Gets a global singleton by name.2527*2528* @param p_name A pointer to a StringName with the singleton name.2529*2530* @return A pointer to the singleton Object.2531*/2532typedef GDExtensionObjectPtr (*GDExtensionInterfaceGlobalGetSingleton)(GDExtensionConstStringNamePtr p_name);25332534/**2535* @name object_get_instance_binding2536* @since 4.12537*2538* Gets a pointer representing an Object's instance binding.2539*2540* @param p_o A pointer to the Object.2541* @param p_token A token the library received by the GDExtension's entry point function.2542* @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct.2543*2544* @return A pointer to the instance binding.2545*/2546typedef void *(*GDExtensionInterfaceObjectGetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks);25472548/**2549* @name object_set_instance_binding2550* @since 4.12551*2552* Sets an Object's instance binding.2553*2554* @param p_o A pointer to the Object.2555* @param p_token A token the library received by the GDExtension's entry point function.2556* @param p_binding A pointer to the instance binding.2557* @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct.2558*/2559typedef void (*GDExtensionInterfaceObjectSetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, void *p_binding, const GDExtensionInstanceBindingCallbacks *p_callbacks);25602561/**2562* @name object_free_instance_binding2563* @since 4.22564*2565* Free an Object's instance binding.2566*2567* @param p_o A pointer to the Object.2568* @param p_token A token the library received by the GDExtension's entry point function.2569*/2570typedef void (*GDExtensionInterfaceObjectFreeInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token);25712572/**2573* @name object_set_instance2574* @since 4.12575*2576* Sets an extension class instance on a Object.2577*2578* `p_classname` should be a registered extension class and should extend the `p_o` Object's class.2579*2580* @param p_o A pointer to the Object.2581* @param p_classname A pointer to a StringName with the registered extension class's name.2582* @param p_instance A pointer to the extension class instance.2583*/2584typedef void (*GDExtensionInterfaceObjectSetInstance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance);25852586/**2587* @name object_get_class_name2588* @since 4.12589*2590* Gets the class name of an Object.2591*2592* If the GDExtension wraps the Godot object in an abstraction specific to its class, this is the2593* function that should be used to determine which wrapper to use.2594*2595* @param p_object A pointer to the Object.2596* @param p_library A pointer the library received by the GDExtension's entry point function.2597* @param r_class_name A pointer to a String to receive the class name.2598*2599* @return true if successful in getting the class name; otherwise false.2600*/2601typedef GDExtensionBool (*GDExtensionInterfaceObjectGetClassName)(GDExtensionConstObjectPtr p_object, GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringNamePtr r_class_name);26022603/**2604* @name object_cast_to2605* @since 4.12606*2607* Casts an Object to a different type.2608*2609* @param p_object A pointer to the Object.2610* @param p_class_tag A pointer uniquely identifying a built-in class in the ClassDB.2611*2612* @return Returns a pointer to the Object, or NULL if it can't be cast to the requested type.2613*/2614typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectCastTo)(GDExtensionConstObjectPtr p_object, void *p_class_tag);26152616/**2617* @name object_get_instance_from_id2618* @since 4.12619*2620* Gets an Object by its instance ID.2621*2622* @param p_instance_id The instance ID.2623*2624* @return A pointer to the Object.2625*/2626typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectGetInstanceFromId)(GDObjectInstanceID p_instance_id);26272628/**2629* @name object_get_instance_id2630* @since 4.12631*2632* Gets the instance ID from an Object.2633*2634* @param p_object A pointer to the Object.2635*2636* @return The instance ID.2637*/2638typedef GDObjectInstanceID (*GDExtensionInterfaceObjectGetInstanceId)(GDExtensionConstObjectPtr p_object);26392640/**2641* @name object_has_script_method2642* @since 4.32643*2644* Checks if this object has a script with the given method.2645*2646* @param p_object A pointer to the Object.2647* @param p_method A pointer to a StringName identifying the method.2648*2649* @return true if the object has a script and that script has a method with the given name. Returns false if the object has no script.2650*/2651typedef GDExtensionBool (*GDExtensionInterfaceObjectHasScriptMethod)(GDExtensionConstObjectPtr p_object, GDExtensionConstStringNamePtr p_method);26522653/**2654* @name object_call_script_method2655* @since 4.32656*2657* Call the given script method on this object.2658*2659* @param p_object A pointer to the Object.2660* @param p_method A pointer to a StringName identifying the method.2661* @param p_args A pointer to a C array of Variant.2662* @param p_argument_count The number of arguments.2663* @param r_return A pointer a Variant which will be assigned the return value.2664* @param r_error A pointer the structure which will hold error information.2665*/2666typedef void (*GDExtensionInterfaceObjectCallScriptMethod)(GDExtensionObjectPtr p_object, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error);26672668/* INTERFACE: Reference */26692670/**2671* @name ref_get_object2672* @since 4.12673*2674* Gets the Object from a reference.2675*2676* @param p_ref A pointer to the reference.2677*2678* @return A pointer to the Object from the reference or NULL.2679*/2680typedef GDExtensionObjectPtr (*GDExtensionInterfaceRefGetObject)(GDExtensionConstRefPtr p_ref);26812682/**2683* @name ref_set_object2684* @since 4.12685*2686* Sets the Object referred to by a reference.2687*2688* @param p_ref A pointer to the reference.2689* @param p_object A pointer to the Object to refer to.2690*/2691typedef void (*GDExtensionInterfaceRefSetObject)(GDExtensionRefPtr p_ref, GDExtensionObjectPtr p_object);26922693/* INTERFACE: Script Instance */26942695/**2696* @name script_instance_create2697* @since 4.12698* @deprecated in Godot 4.2. Use `script_instance_create3` instead.2699*2700* Creates a script instance that contains the given info and instance data.2701*2702* @param p_info A pointer to a GDExtensionScriptInstanceInfo struct.2703* @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info.2704*2705* @return A pointer to a ScriptInstanceExtension object.2706*/2707typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate)(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);27082709/**2710* @name script_instance_create22711* @since 4.22712* @deprecated in Godot 4.3. Use `script_instance_create3` instead.2713*2714* Creates a script instance that contains the given info and instance data.2715*2716* @param p_info A pointer to a GDExtensionScriptInstanceInfo2 struct.2717* @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info.2718*2719* @return A pointer to a ScriptInstanceExtension object.2720*/2721typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate2)(const GDExtensionScriptInstanceInfo2 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);27222723/**2724* @name script_instance_create32725* @since 4.32726*2727* Creates a script instance that contains the given info and instance data.2728*2729* @param p_info A pointer to a GDExtensionScriptInstanceInfo3 struct.2730* @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info.2731*2732* @return A pointer to a ScriptInstanceExtension object.2733*/2734typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate3)(const GDExtensionScriptInstanceInfo3 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data);27352736/**2737* @name placeholder_script_instance_create2738* @since 4.22739*2740* Creates a placeholder script instance for a given script and instance.2741*2742* This interface is optional as a custom placeholder could also be created with script_instance_create().2743*2744* @param p_language A pointer to a ScriptLanguage.2745* @param p_script A pointer to a Script.2746* @param p_owner A pointer to an Object.2747*2748* @return A pointer to a PlaceHolderScriptInstance object.2749*/2750typedef GDExtensionScriptInstancePtr (*GDExtensionInterfacePlaceHolderScriptInstanceCreate)(GDExtensionObjectPtr p_language, GDExtensionObjectPtr p_script, GDExtensionObjectPtr p_owner);27512752/**2753* @name placeholder_script_instance_update2754* @since 4.22755*2756* Updates a placeholder script instance with the given properties and values.2757*2758* The passed in placeholder must be an instance of PlaceHolderScriptInstance2759* such as the one returned by placeholder_script_instance_create().2760*2761* @param p_placeholder A pointer to a PlaceHolderScriptInstance.2762* @param p_properties A pointer to an Array of Dictionary representing PropertyInfo.2763* @param p_values A pointer to a Dictionary mapping StringName to Variant values.2764*/2765typedef void (*GDExtensionInterfacePlaceHolderScriptInstanceUpdate)(GDExtensionScriptInstancePtr p_placeholder, GDExtensionConstTypePtr p_properties, GDExtensionConstTypePtr p_values);27662767/**2768* @name object_get_script_instance2769* @since 4.22770*2771* Get the script instance data attached to this object.2772*2773* @param p_object A pointer to the Object.2774* @param p_language A pointer to the language expected for this script instance.2775*2776* @return A GDExtensionScriptInstanceDataPtr that was attached to this object as part of script_instance_create.2777*/2778typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptInstance)(GDExtensionConstObjectPtr p_object, GDExtensionObjectPtr p_language);27792780/**2781* @name object_set_script_instance2782* @since 4.52783*2784* Set the script instance data attached to this object.2785*2786* @param p_object A pointer to the Object.2787* @param p_script_instance A pointer to the script instance data to attach to this object.2788*/2789typedef void (*GDExtensionInterfaceObjectSetScriptInstance)(GDExtensionObjectPtr p_object, GDExtensionScriptInstanceDataPtr p_script_instance);27902791/* INTERFACE: Callable */27922793/**2794* @name callable_custom_create2795* @since 4.22796* @deprecated in Godot 4.3. Use `callable_custom_create2` instead.2797*2798* Creates a custom Callable object from a function pointer.2799*2800* Provided struct can be safely freed once the function returns.2801*2802* @param r_callable A pointer that will receive the new Callable.2803* @param p_callable_custom_info The info required to construct a Callable.2804*/2805typedef void (*GDExtensionInterfaceCallableCustomCreate)(GDExtensionUninitializedTypePtr r_callable, GDExtensionCallableCustomInfo *p_callable_custom_info);28062807/**2808* @name callable_custom_create22809* @since 4.32810*2811* Creates a custom Callable object from a function pointer.2812*2813* Provided struct can be safely freed once the function returns.2814*2815* @param r_callable A pointer that will receive the new Callable.2816* @param p_callable_custom_info The info required to construct a Callable.2817*/2818typedef void (*GDExtensionInterfaceCallableCustomCreate2)(GDExtensionUninitializedTypePtr r_callable, GDExtensionCallableCustomInfo2 *p_callable_custom_info);28192820/**2821* @name callable_custom_get_userdata2822* @since 4.22823*2824* Retrieves the userdata pointer from a custom Callable.2825*2826* If the Callable is not a custom Callable or the token does not match the one provided to callable_custom_create() via GDExtensionCallableCustomInfo then NULL will be returned.2827*2828* @param p_callable A pointer to a Callable.2829* @param p_token A pointer to an address that uniquely identifies the GDExtension.2830*2831* @return The userdata pointer given when creating this custom Callable.2832*/2833typedef void *(*GDExtensionInterfaceCallableCustomGetUserData)(GDExtensionConstTypePtr p_callable, void *p_token);28342835/* INTERFACE: ClassDB */28362837/**2838* @name classdb_construct_object2839* @since 4.12840* @deprecated in Godot 4.4. Use `classdb_construct_object2` instead.2841*2842* Constructs an Object of the requested class.2843*2844* The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object.2845*2846* @param p_classname A pointer to a StringName with the class name.2847*2848* @return A pointer to the newly created Object.2849*/2850typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject)(GDExtensionConstStringNamePtr p_classname);28512852/**2853* @name classdb_construct_object22854* @since 4.42855*2856* Constructs an Object of the requested class.2857*2858* The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object.2859*2860* "NOTIFICATION_POSTINITIALIZE" must be sent after construction.2861*2862* @param p_classname A pointer to a StringName with the class name.2863*2864* @return A pointer to the newly created Object.2865*/2866typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject2)(GDExtensionConstStringNamePtr p_classname);28672868/**2869* @name classdb_get_method_bind2870* @since 4.12871*2872* Gets a pointer to the MethodBind in ClassDB for the given class, method and hash.2873*2874* @param p_classname A pointer to a StringName with the class name.2875* @param p_methodname A pointer to a StringName with the method name.2876* @param p_hash A hash representing the function signature.2877*2878* @return A pointer to the MethodBind from ClassDB.2879*/2880typedef GDExtensionMethodBindPtr (*GDExtensionInterfaceClassdbGetMethodBind)(GDExtensionConstStringNamePtr p_classname, GDExtensionConstStringNamePtr p_methodname, GDExtensionInt p_hash);28812882/**2883* @name classdb_get_class_tag2884* @since 4.12885*2886* Gets a pointer uniquely identifying the given built-in class in the ClassDB.2887*2888* @param p_classname A pointer to a StringName with the class name.2889*2890* @return A pointer uniquely identifying the built-in class in the ClassDB.2891*/2892typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNamePtr p_classname);28932894/* INTERFACE: ClassDB Extension */28952896/**2897* @name classdb_register_extension_class2898* @since 4.12899* @deprecated in Godot 4.2. Use `classdb_register_extension_class4` instead.2900*2901* Registers an extension class in the ClassDB.2902*2903* Provided struct can be safely freed once the function returns.2904*2905* @param p_library A pointer the library received by the GDExtension's entry point function.2906* @param p_class_name A pointer to a StringName with the class name.2907* @param p_parent_class_name A pointer to a StringName with the parent class name.2908* @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo struct.2909*/2910typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs);29112912/**2913* @name classdb_register_extension_class22914* @since 4.22915* @deprecated in Godot 4.3. Use `classdb_register_extension_class4` instead.2916*2917* Registers an extension class in the ClassDB.2918*2919* Provided struct can be safely freed once the function returns.2920*2921* @param p_library A pointer the library received by the GDExtension's entry point function.2922* @param p_class_name A pointer to a StringName with the class name.2923* @param p_parent_class_name A pointer to a StringName with the parent class name.2924* @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo2 struct.2925*/2926typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass2)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo2 *p_extension_funcs);29272928/**2929* @name classdb_register_extension_class32930* @since 4.32931* @deprecated in Godot 4.4. Use `classdb_register_extension_class4` instead.2932*2933* Registers an extension class in the ClassDB.2934*2935* Provided struct can be safely freed once the function returns.2936*2937* @param p_library A pointer the library received by the GDExtension's entry point function.2938* @param p_class_name A pointer to a StringName with the class name.2939* @param p_parent_class_name A pointer to a StringName with the parent class name.2940* @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo3 struct.2941*/2942typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass3)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo3 *p_extension_funcs);29432944/**2945* @name classdb_register_extension_class42946* @since 4.42947* @deprecated in Godot 4.5. Use `classdb_register_extension_class5` instead.2948*2949* Registers an extension class in the ClassDB.2950*2951* Provided struct can be safely freed once the function returns.2952*2953* @param p_library A pointer the library received by the GDExtension's entry point function.2954* @param p_class_name A pointer to a StringName with the class name.2955* @param p_parent_class_name A pointer to a StringName with the parent class name.2956* @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo4 struct.2957*/2958typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass4)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs);29592960/**2961* @name classdb_register_extension_class52962* @since 4.52963*2964* Registers an extension class in the ClassDB.2965*2966* Provided struct can be safely freed once the function returns.2967*2968* @param p_library A pointer the library received by the GDExtension's entry point function.2969* @param p_class_name A pointer to a StringName with the class name.2970* @param p_parent_class_name A pointer to a StringName with the parent class name.2971* @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo5 struct.2972*/2973typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass5)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo5 *p_extension_funcs);29742975/**2976* @name classdb_register_extension_class_method2977* @since 4.12978*2979* Registers a method on an extension class in the ClassDB.2980*2981* Provided struct can be safely freed once the function returns.2982*2983* @param p_library A pointer the library received by the GDExtension's entry point function.2984* @param p_class_name A pointer to a StringName with the class name.2985* @param p_method_info A pointer to a GDExtensionClassMethodInfo struct.2986*/2987typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassMethod)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassMethodInfo *p_method_info);29882989/**2990* @name classdb_register_extension_class_virtual_method2991* @since 4.32992*2993* Registers a virtual method on an extension class in ClassDB, that can be implemented by scripts or other extensions.2994*2995* Provided struct can be safely freed once the function returns.2996*2997* @param p_library A pointer the library received by the GDExtension's entry point function.2998* @param p_class_name A pointer to a StringName with the class name.2999* @param p_method_info A pointer to a GDExtensionClassMethodInfo struct.3000*/3001typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassVirtualMethod)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassVirtualMethodInfo *p_method_info);30023003/**3004* @name classdb_register_extension_class_integer_constant3005* @since 4.13006*3007* Registers an integer constant on an extension class in the ClassDB.3008*3009* Note about registering bitfield values (if p_is_bitfield is true): even though p_constant_value is signed, language bindings are3010* advised to treat bitfields as uint64_t, since this is generally clearer and can prevent mistakes like using -1 for setting all bits.3011* Language APIs should thus provide an abstraction that registers bitfields (uint64_t) separately from regular constants (int64_t).3012*3013* @param p_library A pointer the library received by the GDExtension's entry point function.3014* @param p_class_name A pointer to a StringName with the class name.3015* @param p_enum_name A pointer to a StringName with the enum name.3016* @param p_constant_name A pointer to a StringName with the constant name.3017* @param p_constant_value The constant value.3018* @param p_is_bitfield Whether or not this constant is part of a bitfield.3019*/3020typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield);30213022/**3023* @name classdb_register_extension_class_property3024* @since 4.13025*3026* Registers a property on an extension class in the ClassDB.3027*3028* Provided struct can be safely freed once the function returns.3029*3030* @param p_library A pointer the library received by the GDExtension's entry point function.3031* @param p_class_name A pointer to a StringName with the class name.3032* @param p_info A pointer to a GDExtensionPropertyInfo struct.3033* @param p_setter A pointer to a StringName with the name of the setter method.3034* @param p_getter A pointer to a StringName with the name of the getter method.3035*/3036typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassProperty)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter);30373038/**3039* @name classdb_register_extension_class_property_indexed3040* @since 4.23041*3042* Registers an indexed property on an extension class in the ClassDB.3043*3044* Provided struct can be safely freed once the function returns.3045*3046* @param p_library A pointer the library received by the GDExtension's entry point function.3047* @param p_class_name A pointer to a StringName with the class name.3048* @param p_info A pointer to a GDExtensionPropertyInfo struct.3049* @param p_setter A pointer to a StringName with the name of the setter method.3050* @param p_getter A pointer to a StringName with the name of the getter method.3051* @param p_index The index to pass as the first argument to the getter and setter methods.3052*/3053typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter, GDExtensionInt p_index);30543055/**3056* @name classdb_register_extension_class_property_group3057* @since 4.13058*3059* Registers a property group on an extension class in the ClassDB.3060*3061* @param p_library A pointer the library received by the GDExtension's entry point function.3062* @param p_class_name A pointer to a StringName with the class name.3063* @param p_group_name A pointer to a String with the group name.3064* @param p_prefix A pointer to a String with the prefix used by properties in this group.3065*/3066typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_group_name, GDExtensionConstStringPtr p_prefix);30673068/**3069* @name classdb_register_extension_class_property_subgroup3070* @since 4.13071*3072* Registers a property subgroup on an extension class in the ClassDB.3073*3074* @param p_library A pointer the library received by the GDExtension's entry point function.3075* @param p_class_name A pointer to a StringName with the class name.3076* @param p_subgroup_name A pointer to a String with the subgroup name.3077* @param p_prefix A pointer to a String with the prefix used by properties in this subgroup.3078*/3079typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_subgroup_name, GDExtensionConstStringPtr p_prefix);30803081/**3082* @name classdb_register_extension_class_signal3083* @since 4.13084*3085* Registers a signal on an extension class in the ClassDB.3086*3087* Provided structs can be safely freed once the function returns.3088*3089* @param p_library A pointer the library received by the GDExtension's entry point function.3090* @param p_class_name A pointer to a StringName with the class name.3091* @param p_signal_name A pointer to a StringName with the signal name.3092* @param p_argument_info A pointer to a GDExtensionPropertyInfo struct.3093* @param p_argument_count The number of arguments the signal receives.3094*/3095typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassSignal)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_signal_name, const GDExtensionPropertyInfo *p_argument_info, GDExtensionInt p_argument_count);30963097/**3098* @name classdb_unregister_extension_class3099* @since 4.13100*3101* Unregisters an extension class in the ClassDB.3102*3103* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first.3104*3105* @param p_library A pointer the library received by the GDExtension's entry point function.3106* @param p_class_name A pointer to a StringName with the class name.3107*/3108typedef void (*GDExtensionInterfaceClassdbUnregisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name);31093110/**3111* @name get_library_path3112* @since 4.13113*3114* Gets the path to the current GDExtension library.3115*3116* @param p_library A pointer the library received by the GDExtension's entry point function.3117* @param r_path A pointer to a String which will receive the path.3118*/3119typedef void (*GDExtensionInterfaceGetLibraryPath)(GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringPtr r_path);31203121/**3122* @name editor_add_plugin3123* @since 4.13124*3125* Adds an editor plugin.3126*3127* It's safe to call during initialization.3128*3129* @param p_class_name A pointer to a StringName with the name of a class (descending from EditorPlugin) which is already registered with ClassDB.3130*/3131typedef void (*GDExtensionInterfaceEditorAddPlugin)(GDExtensionConstStringNamePtr p_class_name);31323133/**3134* @name editor_remove_plugin3135* @since 4.13136*3137* Removes an editor plugin.3138*3139* @param p_class_name A pointer to a StringName with the name of a class that was previously added as an editor plugin.3140*/3141typedef void (*GDExtensionInterfaceEditorRemovePlugin)(GDExtensionConstStringNamePtr p_class_name);31423143/**3144* @name editor_help_load_xml_from_utf8_chars3145* @since 4.33146*3147* Loads new XML-formatted documentation data in the editor.3148*3149* The provided pointer can be immediately freed once the function returns.3150*3151* @param p_data A pointer to a UTF-8 encoded C string (null terminated).3152*/3153typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8Chars)(const char *p_data);31543155/**3156* @name editor_help_load_xml_from_utf8_chars_and_len3157* @since 4.33158*3159* Loads new XML-formatted documentation data in the editor.3160*3161* The provided pointer can be immediately freed once the function returns.3162*3163* @param p_data A pointer to a UTF-8 encoded C string.3164* @param p_size The number of bytes (not code units).3165*/3166typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen)(const char *p_data, GDExtensionInt p_size);31673168/**3169* @name editor_register_get_classes_used_callback3170* @since 4.53171*3172* Registers a callback that Godot can call to get the list of all classes (from ClassDB) that may be used by the calling GDExtension.3173*3174* This is used by the editor to generate a build profile (in "Tools" > "Engine Compilation Configuration Editor..." > "Detect from project"),3175* in order to recompile Godot with only the classes used.3176* In the provided callback, the GDExtension should provide the list of classes that _may_ be used statically, thus the time of invocation shouldn't matter.3177* If a GDExtension doesn't register a callback, Godot will assume that it could be using any classes.3178*3179* @param p_library A pointer the library received by the GDExtension's entry point function.3180* @param p_callback The callback to retrieve the list of classes used.3181*/3182typedef void (*GDExtensionInterfaceEditorRegisterGetClassesUsedCallback)(GDExtensionClassLibraryPtr p_library, GDExtensionEditorGetClassesUsedCallback p_callback);31833184/**3185* @name register_main_loop_callbacks3186* @since 4.53187*3188* Registers callbacks to be called at different phases of the main loop.3189*3190* @param p_library A pointer the library received by the GDExtension's entry point function.3191* @param p_callbacks A pointer to the structure that contains the callbacks.3192*/3193typedef void (*GDExtensionInterfaceRegisterMainLoopCallbacks)(GDExtensionClassLibraryPtr p_library, const GDExtensionMainLoopCallbacks *p_callbacks);31943195#ifdef __cplusplus3196}3197#endif319831993200