Rework GDExtension interface from a struct to loading function pointers

This commit is contained in:
David Snopek 2023-04-24 10:15:27 -05:00
parent 755c61b57a
commit 9b9482d4bb
5 changed files with 2236 additions and 436 deletions

View File

@ -34,6 +34,13 @@
#include "core/object/class_db.h"
#include "core/object/method_bind.h"
#include "core/os/os.h"
#include "core/version.h"
extern void gdextension_setup_interface();
extern void *gdextension_get_legacy_interface();
extern GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name);
typedef GDExtensionBool (*GDExtensionLegacyInitializationFunction)(void *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);
String GDExtension::get_extension_list_config_file() {
return ProjectSettings::get_singleton()->get_project_data_path().path_join("extension_list.cfg");
@ -275,8 +282,6 @@ public:
}
};
static GDExtensionInterface gdextension_interface;
void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs) {
GDExtension *self = reinterpret_cast<GDExtension *>(p_library);
@ -431,7 +436,20 @@ void GDExtension::_get_library_path(GDExtensionClassLibraryPtr p_library, GDExte
memnew_placement(r_path, String(self->library_path));
}
Error GDExtension::open_library(const String &p_path, const String &p_entry_symbol) {
HashMap<StringName, GDExtensionInterfaceFunctionPtr> gdextension_interface_functions;
void GDExtension::register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) {
ERR_FAIL_COND_MSG(gdextension_interface_functions.has(p_function_name), "Attempt to register interface function '" + p_function_name + "', which appears to be already registered.");
gdextension_interface_functions.insert(p_function_name, p_function_pointer);
}
GDExtensionInterfaceFunctionPtr GDExtension::get_interface_function(StringName p_function_name) {
GDExtensionInterfaceFunctionPtr *function = gdextension_interface_functions.getptr(p_function_name);
ERR_FAIL_COND_V_MSG(function == nullptr, nullptr, "Attempt to get non-existent interface function: " + p_function_name);
return *function;
}
Error GDExtension::open_library(const String &p_path, const String &p_entry_symbol, bool p_use_legacy_interface) {
Error err = OS::get_singleton()->open_dynamic_library(p_path, library, true, &library_path);
if (err != OK) {
ERR_PRINT("GDExtension dynamic library not found: " + p_path);
@ -448,9 +466,17 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb
return err;
}
GDExtensionInitializationFunction initialization_function = (GDExtensionInitializationFunction)entry_funcptr;
GDExtensionBool ret = 0;
if (p_use_legacy_interface) {
GDExtensionLegacyInitializationFunction initialization_function = (GDExtensionLegacyInitializationFunction)entry_funcptr;
ret = initialization_function(gdextension_get_legacy_interface(), this, &initialization);
if (initialization_function(&gdextension_interface, this, &initialization)) {
} else {
GDExtensionInitializationFunction initialization_function = (GDExtensionInitializationFunction)entry_funcptr;
ret = initialization_function(&gdextension_get_proc_address, this, &initialization);
}
if (ret) {
level_initialized = -1;
return OK;
} else {
@ -459,6 +485,10 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb
}
}
Error GDExtension::open_library_compat_76406(const String &p_path, const String &p_entry_symbol) {
return open_library(p_path, p_entry_symbol, true);
}
void GDExtension::close_library() {
ERR_FAIL_COND(library == nullptr);
OS::get_singleton()->close_dynamic_library(library);
@ -494,7 +524,8 @@ void GDExtension::deinitialize_library(InitializationLevel p_level) {
}
void GDExtension::_bind_methods() {
ClassDB::bind_method(D_METHOD("open_library", "path", "entry_symbol"), &GDExtension::open_library);
ClassDB::bind_method(D_METHOD("open_library", "path", "entry_symbol", "use_legacy_interface"), &GDExtension::open_library);
ClassDB::bind_compatibility_method(D_METHOD("open_library", "path", "entry_symbol"), &GDExtension::open_library_compat_76406);
ClassDB::bind_method(D_METHOD("close_library"), &GDExtension::close_library);
ClassDB::bind_method(D_METHOD("is_library_open"), &GDExtension::is_library_open);
@ -516,20 +547,18 @@ GDExtension::~GDExtension() {
}
}
extern void gdextension_setup_interface(GDExtensionInterface *p_interface);
void GDExtension::initialize_gdextensions() {
gdextension_setup_interface(&gdextension_interface);
gdextension_setup_interface();
gdextension_interface.classdb_register_extension_class = _register_extension_class;
gdextension_interface.classdb_register_extension_class_method = _register_extension_class_method;
gdextension_interface.classdb_register_extension_class_integer_constant = _register_extension_class_integer_constant;
gdextension_interface.classdb_register_extension_class_property = _register_extension_class_property;
gdextension_interface.classdb_register_extension_class_property_group = _register_extension_class_property_group;
gdextension_interface.classdb_register_extension_class_property_subgroup = _register_extension_class_property_subgroup;
gdextension_interface.classdb_register_extension_class_signal = _register_extension_class_signal;
gdextension_interface.classdb_unregister_extension_class = _unregister_extension_class;
gdextension_interface.get_library_path = _get_library_path;
register_interface_function("classdb_register_extension_class", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class);
register_interface_function("classdb_register_extension_class_method", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_method);
register_interface_function("classdb_register_extension_class_integer_constant", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_integer_constant);
register_interface_function("classdb_register_extension_class_property", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_property);
register_interface_function("classdb_register_extension_class_property_group", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_property_group);
register_interface_function("classdb_register_extension_class_property_subgroup", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_property_subgroup);
register_interface_function("classdb_register_extension_class_signal", (GDExtensionInterfaceFunctionPtr)&GDExtension::_register_extension_class_signal);
register_interface_function("classdb_unregister_extension_class", (GDExtensionInterfaceFunctionPtr)&GDExtension::_unregister_extension_class);
register_interface_function("get_library_path", (GDExtensionInterfaceFunctionPtr)&GDExtension::_get_library_path);
}
Ref<Resource> GDExtensionResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
@ -557,6 +586,39 @@ Ref<Resource> GDExtensionResourceLoader::load(const String &p_path, const String
String entry_symbol = config->get_value("configuration", "entry_symbol");
uint32_t compatibility_minimum[3] = { 0, 0, 0 };
if (config->has_section_key("configuration", "compatibility_minimum")) {
String compat_string = config->get_value("configuration", "compatibility_minimum");
Vector<int> parts = compat_string.split_ints(".");
for (int i = 0; i < parts.size(); i++) {
if (i >= 3) {
break;
}
if (parts[i] >= 0) {
compatibility_minimum[i] = parts[i];
}
}
}
if (compatibility_minimum[0] < 4) {
compatibility_minimum[0] = 4;
}
bool compatible = true;
if (VERSION_MAJOR < compatibility_minimum[0]) {
compatible = false;
} else if (VERSION_MINOR < compatibility_minimum[1]) {
compatible = false;
} else if (VERSION_PATCH < compatibility_minimum[2]) {
compatible = false;
}
if (!compatible) {
if (r_error) {
*r_error = ERR_INVALID_DATA;
}
ERR_PRINT(vformat("GDExtension only compatible with Godot version %d.%d.%d or later: %s", compatibility_minimum[0], compatibility_minimum[1], compatibility_minimum[2], p_path));
return Ref<Resource>();
}
String library_path = GDExtension::find_extension_library(p_path, config, [](String p_feature) { return OS::get_singleton()->has_feature(p_feature); });
if (library_path.is_empty()) {
@ -572,10 +634,12 @@ Ref<Resource> GDExtensionResourceLoader::load(const String &p_path, const String
library_path = p_path.get_base_dir().path_join(library_path);
}
bool use_legacy_interface = compatibility_minimum[0] == 4 && compatibility_minimum[1] == 0;
Ref<GDExtension> lib;
lib.instantiate();
String abs_path = ProjectSettings::get_singleton()->globalize_path(library_path);
err = lib->open_library(abs_path, entry_symbol);
err = lib->open_library(abs_path, entry_symbol, use_legacy_interface);
if (r_error) {
*r_error = err;

View File

@ -72,7 +72,8 @@ public:
static String get_extension_list_config_file();
static String find_extension_library(const String &p_path, Ref<ConfigFile> p_config, std::function<bool(String)> p_has_feature, PackedStringArray *r_tags = nullptr);
Error open_library(const String &p_path, const String &p_entry_symbol);
Error open_library(const String &p_path, const String &p_entry_symbol, bool p_use_legacy_interface = false);
Error open_library_compat_76406(const String &p_path, const String &p_entry_symbol);
void close_library();
enum InitializationLevel {
@ -88,7 +89,10 @@ public:
void initialize_library(InitializationLevel p_level);
void deinitialize_library(InitializationLevel p_level);
static void register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer);
static GDExtensionInterfaceFunctionPtr get_interface_function(StringName p_function_name);
static void initialize_gdextensions();
GDExtension();
~GDExtension();
};

View File

@ -31,6 +31,7 @@
#include "gdextension_interface.h"
#include "core/config/engine.h"
#include "core/extension/gdextension.h"
#include "core/io/file_access.h"
#include "core/io/xml_parser.h"
#include "core/object/class_db.h"
@ -40,16 +41,28 @@
#include "core/variant/variant.h"
#include "core/version.h"
// Core interface functions.
GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name) {
return GDExtension::get_interface_function(p_name);
}
static void gdextension_get_godot_version(GDExtensionGodotVersion *r_godot_version) {
r_godot_version->major = VERSION_MAJOR;
r_godot_version->minor = VERSION_MINOR;
r_godot_version->patch = VERSION_PATCH;
r_godot_version->string = VERSION_FULL_NAME;
}
// Memory Functions
static void *gdextension_alloc(size_t p_size) {
static void *gdextension_mem_alloc(size_t p_size) {
return memalloc(p_size);
}
static void *gdextension_realloc(void *p_mem, size_t p_size) {
static void *gdextension_mem_realloc(void *p_mem, size_t p_size) {
return memrealloc(p_mem, p_size);
}
static void gdextension_free(void *p_mem) {
static void gdextension_mem_free(void *p_mem) {
memfree(p_mem);
}
@ -397,7 +410,7 @@ static GDExtensionVariantFromTypeConstructorFunc gdextension_get_variant_from_ty
ERR_FAIL_V_MSG(nullptr, "Getting Variant conversion function with invalid type");
}
static GDExtensionTypeFromVariantConstructorFunc gdextension_get_type_from_variant_constructor(GDExtensionVariantType p_type) {
static GDExtensionTypeFromVariantConstructorFunc gdextension_get_variant_to_type_constructor(GDExtensionVariantType p_type) {
switch (p_type) {
case GDEXTENSION_VARIANT_TYPE_BOOL:
return VariantTypeConstructor<bool>::type_from_variant;
@ -1045,204 +1058,452 @@ static void *gdextension_classdb_get_class_tag(GDExtensionConstStringNamePtr p_c
return class_info ? class_info->class_ptr : nullptr;
}
void gdextension_setup_interface(GDExtensionInterface *p_interface) {
GDExtensionInterface &gde_interface = *p_interface;
#define REGISTER_INTERFACE_FUNC(m_name) GDExtension::register_interface_function(#m_name, (GDExtensionInterfaceFunctionPtr)&gdextension_##m_name)
gde_interface.version_major = VERSION_MAJOR;
gde_interface.version_minor = VERSION_MINOR;
#if VERSION_PATCH
gde_interface.version_patch = VERSION_PATCH;
#else
gde_interface.version_patch = 0;
#endif
gde_interface.version_string = VERSION_FULL_NAME;
/* GODOT CORE */
gde_interface.mem_alloc = gdextension_alloc;
gde_interface.mem_realloc = gdextension_realloc;
gde_interface.mem_free = gdextension_free;
gde_interface.print_error = gdextension_print_error;
gde_interface.print_error_with_message = gdextension_print_error_with_message;
gde_interface.print_warning = gdextension_print_warning;
gde_interface.print_warning_with_message = gdextension_print_warning_with_message;
gde_interface.print_script_error = gdextension_print_script_error;
gde_interface.print_script_error_with_message = gdextension_print_script_error_with_message;
gde_interface.get_native_struct_size = gdextension_get_native_struct_size;
/* GODOT VARIANT */
// variant general
gde_interface.variant_new_copy = gdextension_variant_new_copy;
gde_interface.variant_new_nil = gdextension_variant_new_nil;
gde_interface.variant_destroy = gdextension_variant_destroy;
gde_interface.variant_call = gdextension_variant_call;
gde_interface.variant_call_static = gdextension_variant_call_static;
gde_interface.variant_evaluate = gdextension_variant_evaluate;
gde_interface.variant_set = gdextension_variant_set;
gde_interface.variant_set_named = gdextension_variant_set_named;
gde_interface.variant_set_keyed = gdextension_variant_set_keyed;
gde_interface.variant_set_indexed = gdextension_variant_set_indexed;
gde_interface.variant_get = gdextension_variant_get;
gde_interface.variant_get_named = gdextension_variant_get_named;
gde_interface.variant_get_keyed = gdextension_variant_get_keyed;
gde_interface.variant_get_indexed = gdextension_variant_get_indexed;
gde_interface.variant_iter_init = gdextension_variant_iter_init;
gde_interface.variant_iter_next = gdextension_variant_iter_next;
gde_interface.variant_iter_get = gdextension_variant_iter_get;
gde_interface.variant_hash = gdextension_variant_hash;
gde_interface.variant_recursive_hash = gdextension_variant_recursive_hash;
gde_interface.variant_hash_compare = gdextension_variant_hash_compare;
gde_interface.variant_booleanize = gdextension_variant_booleanize;
gde_interface.variant_duplicate = gdextension_variant_duplicate;
gde_interface.variant_stringify = gdextension_variant_stringify;
gde_interface.variant_get_type = gdextension_variant_get_type;
gde_interface.variant_has_method = gdextension_variant_has_method;
gde_interface.variant_has_member = gdextension_variant_has_member;
gde_interface.variant_has_key = gdextension_variant_has_key;
gde_interface.variant_get_type_name = gdextension_variant_get_type_name;
gde_interface.variant_can_convert = gdextension_variant_can_convert;
gde_interface.variant_can_convert_strict = gdextension_variant_can_convert_strict;
gde_interface.get_variant_from_type_constructor = gdextension_get_variant_from_type_constructor;
gde_interface.get_variant_to_type_constructor = gdextension_get_type_from_variant_constructor;
// ptrcalls.
gde_interface.variant_get_ptr_operator_evaluator = gdextension_variant_get_ptr_operator_evaluator;
gde_interface.variant_get_ptr_builtin_method = gdextension_variant_get_ptr_builtin_method;
gde_interface.variant_get_ptr_constructor = gdextension_variant_get_ptr_constructor;
gde_interface.variant_get_ptr_destructor = gdextension_variant_get_ptr_destructor;
gde_interface.variant_construct = gdextension_variant_construct;
gde_interface.variant_get_ptr_setter = gdextension_variant_get_ptr_setter;
gde_interface.variant_get_ptr_getter = gdextension_variant_get_ptr_getter;
gde_interface.variant_get_ptr_indexed_setter = gdextension_variant_get_ptr_indexed_setter;
gde_interface.variant_get_ptr_indexed_getter = gdextension_variant_get_ptr_indexed_getter;
gde_interface.variant_get_ptr_keyed_setter = gdextension_variant_get_ptr_keyed_setter;
gde_interface.variant_get_ptr_keyed_getter = gdextension_variant_get_ptr_keyed_getter;
gde_interface.variant_get_ptr_keyed_checker = gdextension_variant_get_ptr_keyed_checker;
gde_interface.variant_get_constant_value = gdextension_variant_get_constant_value;
gde_interface.variant_get_ptr_utility_function = gdextension_variant_get_ptr_utility_function;
// extra utilities
gde_interface.string_new_with_latin1_chars = gdextension_string_new_with_latin1_chars;
gde_interface.string_new_with_utf8_chars = gdextension_string_new_with_utf8_chars;
gde_interface.string_new_with_utf16_chars = gdextension_string_new_with_utf16_chars;
gde_interface.string_new_with_utf32_chars = gdextension_string_new_with_utf32_chars;
gde_interface.string_new_with_wide_chars = gdextension_string_new_with_wide_chars;
gde_interface.string_new_with_latin1_chars_and_len = gdextension_string_new_with_latin1_chars_and_len;
gde_interface.string_new_with_utf8_chars_and_len = gdextension_string_new_with_utf8_chars_and_len;
gde_interface.string_new_with_utf16_chars_and_len = gdextension_string_new_with_utf16_chars_and_len;
gde_interface.string_new_with_utf32_chars_and_len = gdextension_string_new_with_utf32_chars_and_len;
gde_interface.string_new_with_wide_chars_and_len = gdextension_string_new_with_wide_chars_and_len;
gde_interface.string_to_latin1_chars = gdextension_string_to_latin1_chars;
gde_interface.string_to_utf8_chars = gdextension_string_to_utf8_chars;
gde_interface.string_to_utf16_chars = gdextension_string_to_utf16_chars;
gde_interface.string_to_utf32_chars = gdextension_string_to_utf32_chars;
gde_interface.string_to_wide_chars = gdextension_string_to_wide_chars;
gde_interface.string_operator_index = gdextension_string_operator_index;
gde_interface.string_operator_index_const = gdextension_string_operator_index_const;
gde_interface.string_operator_plus_eq_string = gdextension_string_operator_plus_eq_string;
gde_interface.string_operator_plus_eq_char = gdextension_string_operator_plus_eq_char;
gde_interface.string_operator_plus_eq_cstr = gdextension_string_operator_plus_eq_cstr;
gde_interface.string_operator_plus_eq_wcstr = gdextension_string_operator_plus_eq_wcstr;
gde_interface.string_operator_plus_eq_c32str = gdextension_string_operator_plus_eq_c32str;
/* XMLParser extra utilities */
gde_interface.xml_parser_open_buffer = gdextension_xml_parser_open_buffer;
/* FileAccess extra utilities */
gde_interface.file_access_store_buffer = gdextension_file_access_store_buffer;
gde_interface.file_access_get_buffer = gdextension_file_access_get_buffer;
/* WorkerThreadPool extra utilities */
gde_interface.worker_thread_pool_add_native_group_task = gdextension_worker_thread_pool_add_native_group_task;
gde_interface.worker_thread_pool_add_native_task = gdextension_worker_thread_pool_add_native_task;
/* Packed array functions */
gde_interface.packed_byte_array_operator_index = gdextension_packed_byte_array_operator_index;
gde_interface.packed_byte_array_operator_index_const = gdextension_packed_byte_array_operator_index_const;
gde_interface.packed_color_array_operator_index = gdextension_packed_color_array_operator_index;
gde_interface.packed_color_array_operator_index_const = gdextension_packed_color_array_operator_index_const;
gde_interface.packed_float32_array_operator_index = gdextension_packed_float32_array_operator_index;
gde_interface.packed_float32_array_operator_index_const = gdextension_packed_float32_array_operator_index_const;
gde_interface.packed_float64_array_operator_index = gdextension_packed_float64_array_operator_index;
gde_interface.packed_float64_array_operator_index_const = gdextension_packed_float64_array_operator_index_const;
gde_interface.packed_int32_array_operator_index = gdextension_packed_int32_array_operator_index;
gde_interface.packed_int32_array_operator_index_const = gdextension_packed_int32_array_operator_index_const;
gde_interface.packed_int64_array_operator_index = gdextension_packed_int64_array_operator_index;
gde_interface.packed_int64_array_operator_index_const = gdextension_packed_int64_array_operator_index_const;
gde_interface.packed_string_array_operator_index = gdextension_packed_string_array_operator_index;
gde_interface.packed_string_array_operator_index_const = gdextension_packed_string_array_operator_index_const;
gde_interface.packed_vector2_array_operator_index = gdextension_packed_vector2_array_operator_index;
gde_interface.packed_vector2_array_operator_index_const = gdextension_packed_vector2_array_operator_index_const;
gde_interface.packed_vector3_array_operator_index = gdextension_packed_vector3_array_operator_index;
gde_interface.packed_vector3_array_operator_index_const = gdextension_packed_vector3_array_operator_index_const;
gde_interface.array_operator_index = gdextension_array_operator_index;
gde_interface.array_operator_index_const = gdextension_array_operator_index_const;
gde_interface.array_ref = gdextension_array_ref;
gde_interface.array_set_typed = gdextension_array_set_typed;
/* Dictionary functions */
gde_interface.dictionary_operator_index = gdextension_dictionary_operator_index;
gde_interface.dictionary_operator_index_const = gdextension_dictionary_operator_index_const;
/* OBJECT */
gde_interface.object_method_bind_call = gdextension_object_method_bind_call;
gde_interface.object_method_bind_ptrcall = gdextension_object_method_bind_ptrcall;
gde_interface.object_destroy = gdextension_object_destroy;
gde_interface.global_get_singleton = gdextension_global_get_singleton;
gde_interface.object_get_instance_binding = gdextension_object_get_instance_binding;
gde_interface.object_set_instance_binding = gdextension_object_set_instance_binding;
gde_interface.object_set_instance = gdextension_object_set_instance;
gde_interface.object_cast_to = gdextension_object_cast_to;
gde_interface.object_get_instance_from_id = gdextension_object_get_instance_from_id;
gde_interface.object_get_instance_id = gdextension_object_get_instance_id;
/* REFERENCE */
gde_interface.ref_get_object = gdextension_ref_get_object;
gde_interface.ref_set_object = gdextension_ref_set_object;
/* SCRIPT INSTANCE */
gde_interface.script_instance_create = gdextension_script_instance_create;
/* CLASSDB */
gde_interface.classdb_construct_object = gdextension_classdb_construct_object;
gde_interface.classdb_get_method_bind = gdextension_classdb_get_method_bind;
gde_interface.classdb_get_class_tag = gdextension_classdb_get_class_tag;
/* CLASSDB EXTENSION */
//these are filled by implementation, since it will want to keep track of registered classes
gde_interface.classdb_register_extension_class = nullptr;
gde_interface.classdb_register_extension_class_method = nullptr;
gde_interface.classdb_register_extension_class_integer_constant = nullptr;
gde_interface.classdb_register_extension_class_property = nullptr;
gde_interface.classdb_register_extension_class_property_group = nullptr;
gde_interface.classdb_register_extension_class_property_subgroup = nullptr;
gde_interface.classdb_register_extension_class_signal = nullptr;
gde_interface.classdb_unregister_extension_class = nullptr;
gde_interface.get_library_path = nullptr;
void gdextension_setup_interface() {
REGISTER_INTERFACE_FUNC(get_godot_version);
REGISTER_INTERFACE_FUNC(mem_alloc);
REGISTER_INTERFACE_FUNC(mem_realloc);
REGISTER_INTERFACE_FUNC(mem_free);
REGISTER_INTERFACE_FUNC(print_error);
REGISTER_INTERFACE_FUNC(print_error_with_message);
REGISTER_INTERFACE_FUNC(print_warning);
REGISTER_INTERFACE_FUNC(print_warning_with_message);
REGISTER_INTERFACE_FUNC(print_script_error);
REGISTER_INTERFACE_FUNC(print_script_error_with_message);
REGISTER_INTERFACE_FUNC(get_native_struct_size);
REGISTER_INTERFACE_FUNC(variant_new_copy);
REGISTER_INTERFACE_FUNC(variant_new_nil);
REGISTER_INTERFACE_FUNC(variant_destroy);
REGISTER_INTERFACE_FUNC(variant_call);
REGISTER_INTERFACE_FUNC(variant_call_static);
REGISTER_INTERFACE_FUNC(variant_evaluate);
REGISTER_INTERFACE_FUNC(variant_set);
REGISTER_INTERFACE_FUNC(variant_set_named);
REGISTER_INTERFACE_FUNC(variant_set_keyed);
REGISTER_INTERFACE_FUNC(variant_set_indexed);
REGISTER_INTERFACE_FUNC(variant_get);
REGISTER_INTERFACE_FUNC(variant_get_named);
REGISTER_INTERFACE_FUNC(variant_get_keyed);
REGISTER_INTERFACE_FUNC(variant_get_indexed);
REGISTER_INTERFACE_FUNC(variant_iter_init);
REGISTER_INTERFACE_FUNC(variant_iter_next);
REGISTER_INTERFACE_FUNC(variant_iter_get);
REGISTER_INTERFACE_FUNC(variant_hash);
REGISTER_INTERFACE_FUNC(variant_recursive_hash);
REGISTER_INTERFACE_FUNC(variant_hash_compare);
REGISTER_INTERFACE_FUNC(variant_booleanize);
REGISTER_INTERFACE_FUNC(variant_duplicate);
REGISTER_INTERFACE_FUNC(variant_stringify);
REGISTER_INTERFACE_FUNC(variant_get_type);
REGISTER_INTERFACE_FUNC(variant_has_method);
REGISTER_INTERFACE_FUNC(variant_has_member);
REGISTER_INTERFACE_FUNC(variant_has_key);
REGISTER_INTERFACE_FUNC(variant_get_type_name);
REGISTER_INTERFACE_FUNC(variant_can_convert);
REGISTER_INTERFACE_FUNC(variant_can_convert_strict);
REGISTER_INTERFACE_FUNC(get_variant_from_type_constructor);
REGISTER_INTERFACE_FUNC(get_variant_to_type_constructor);
REGISTER_INTERFACE_FUNC(variant_get_ptr_operator_evaluator);
REGISTER_INTERFACE_FUNC(variant_get_ptr_builtin_method);
REGISTER_INTERFACE_FUNC(variant_get_ptr_constructor);
REGISTER_INTERFACE_FUNC(variant_get_ptr_destructor);
REGISTER_INTERFACE_FUNC(variant_construct);
REGISTER_INTERFACE_FUNC(variant_get_ptr_setter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_getter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_indexed_setter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_indexed_getter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_keyed_setter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_keyed_getter);
REGISTER_INTERFACE_FUNC(variant_get_ptr_keyed_checker);
REGISTER_INTERFACE_FUNC(variant_get_constant_value);
REGISTER_INTERFACE_FUNC(variant_get_ptr_utility_function);
REGISTER_INTERFACE_FUNC(string_new_with_latin1_chars);
REGISTER_INTERFACE_FUNC(string_new_with_utf8_chars);
REGISTER_INTERFACE_FUNC(string_new_with_utf16_chars);
REGISTER_INTERFACE_FUNC(string_new_with_utf32_chars);
REGISTER_INTERFACE_FUNC(string_new_with_wide_chars);
REGISTER_INTERFACE_FUNC(string_new_with_latin1_chars_and_len);
REGISTER_INTERFACE_FUNC(string_new_with_utf8_chars_and_len);
REGISTER_INTERFACE_FUNC(string_new_with_utf16_chars_and_len);
REGISTER_INTERFACE_FUNC(string_new_with_utf32_chars_and_len);
REGISTER_INTERFACE_FUNC(string_new_with_wide_chars_and_len);
REGISTER_INTERFACE_FUNC(string_to_latin1_chars);
REGISTER_INTERFACE_FUNC(string_to_utf8_chars);
REGISTER_INTERFACE_FUNC(string_to_utf16_chars);
REGISTER_INTERFACE_FUNC(string_to_utf32_chars);
REGISTER_INTERFACE_FUNC(string_to_wide_chars);
REGISTER_INTERFACE_FUNC(string_operator_index);
REGISTER_INTERFACE_FUNC(string_operator_index_const);
REGISTER_INTERFACE_FUNC(string_operator_plus_eq_string);
REGISTER_INTERFACE_FUNC(string_operator_plus_eq_char);
REGISTER_INTERFACE_FUNC(string_operator_plus_eq_cstr);
REGISTER_INTERFACE_FUNC(string_operator_plus_eq_wcstr);
REGISTER_INTERFACE_FUNC(string_operator_plus_eq_c32str);
REGISTER_INTERFACE_FUNC(xml_parser_open_buffer);
REGISTER_INTERFACE_FUNC(file_access_store_buffer);
REGISTER_INTERFACE_FUNC(file_access_get_buffer);
REGISTER_INTERFACE_FUNC(worker_thread_pool_add_native_group_task);
REGISTER_INTERFACE_FUNC(worker_thread_pool_add_native_task);
REGISTER_INTERFACE_FUNC(packed_byte_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_byte_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_color_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_color_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_float32_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_float32_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_float64_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_float64_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_int32_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_int32_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_int64_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_int64_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_string_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_string_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_vector2_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_vector2_array_operator_index_const);
REGISTER_INTERFACE_FUNC(packed_vector3_array_operator_index);
REGISTER_INTERFACE_FUNC(packed_vector3_array_operator_index_const);
REGISTER_INTERFACE_FUNC(array_operator_index);
REGISTER_INTERFACE_FUNC(array_operator_index_const);
REGISTER_INTERFACE_FUNC(array_ref);
REGISTER_INTERFACE_FUNC(array_set_typed);
REGISTER_INTERFACE_FUNC(dictionary_operator_index);
REGISTER_INTERFACE_FUNC(dictionary_operator_index_const);
REGISTER_INTERFACE_FUNC(object_method_bind_call);
REGISTER_INTERFACE_FUNC(object_method_bind_ptrcall);
REGISTER_INTERFACE_FUNC(object_destroy);
REGISTER_INTERFACE_FUNC(global_get_singleton);
REGISTER_INTERFACE_FUNC(object_get_instance_binding);
REGISTER_INTERFACE_FUNC(object_set_instance_binding);
REGISTER_INTERFACE_FUNC(object_set_instance);
REGISTER_INTERFACE_FUNC(object_cast_to);
REGISTER_INTERFACE_FUNC(object_get_instance_from_id);
REGISTER_INTERFACE_FUNC(object_get_instance_id);
REGISTER_INTERFACE_FUNC(ref_get_object);
REGISTER_INTERFACE_FUNC(ref_set_object);
REGISTER_INTERFACE_FUNC(script_instance_create);
REGISTER_INTERFACE_FUNC(classdb_construct_object);
REGISTER_INTERFACE_FUNC(classdb_get_method_bind);
REGISTER_INTERFACE_FUNC(classdb_get_class_tag);
}
#undef REGISTER_INTERFACE_FUNCTION
/*
* Handle legacy GDExtension interface from Godot 4.0.
*/
typedef struct {
uint32_t version_major;
uint32_t version_minor;
uint32_t version_patch;
const char *version_string;
GDExtensionInterfaceMemAlloc mem_alloc;
GDExtensionInterfaceMemRealloc mem_realloc;
GDExtensionInterfaceMemFree mem_free;
GDExtensionInterfacePrintError print_error;
GDExtensionInterfacePrintErrorWithMessage print_error_with_message;
GDExtensionInterfacePrintWarning print_warning;
GDExtensionInterfacePrintWarningWithMessage print_warning_with_message;
GDExtensionInterfacePrintScriptError print_script_error;
GDExtensionInterfacePrintScriptErrorWithMessage print_script_error_with_message;
GDExtensionInterfaceGetNativeStructSize get_native_struct_size;
GDExtensionInterfaceVariantNewCopy variant_new_copy;
GDExtensionInterfaceVariantNewNil variant_new_nil;
GDExtensionInterfaceVariantDestroy variant_destroy;
GDExtensionInterfaceVariantCall variant_call;
GDExtensionInterfaceVariantCallStatic variant_call_static;
GDExtensionInterfaceVariantEvaluate variant_evaluate;
GDExtensionInterfaceVariantSet variant_set;
GDExtensionInterfaceVariantSetNamed variant_set_named;
GDExtensionInterfaceVariantSetKeyed variant_set_keyed;
GDExtensionInterfaceVariantSetIndexed variant_set_indexed;
GDExtensionInterfaceVariantGet variant_get;
GDExtensionInterfaceVariantGetNamed variant_get_named;
GDExtensionInterfaceVariantGetKeyed variant_get_keyed;
GDExtensionInterfaceVariantGetIndexed variant_get_indexed;
GDExtensionInterfaceVariantIterInit variant_iter_init;
GDExtensionInterfaceVariantIterNext variant_iter_next;
GDExtensionInterfaceVariantIterGet variant_iter_get;
GDExtensionInterfaceVariantHash variant_hash;
GDExtensionInterfaceVariantRecursiveHash variant_recursive_hash;
GDExtensionInterfaceVariantHashCompare variant_hash_compare;
GDExtensionInterfaceVariantBooleanize variant_booleanize;
GDExtensionInterfaceVariantDuplicate variant_duplicate;
GDExtensionInterfaceVariantStringify variant_stringify;
GDExtensionInterfaceVariantGetType variant_get_type;
GDExtensionInterfaceVariantHasMethod variant_has_method;
GDExtensionInterfaceVariantHasMember variant_has_member;
GDExtensionInterfaceVariantHasKey variant_has_key;
GDExtensionInterfaceVariantGetTypeName variant_get_type_name;
GDExtensionInterfaceVariantCanConvert variant_can_convert;
GDExtensionInterfaceVariantCanConvertStrict variant_can_convert_strict;
GDExtensionInterfaceGetVariantFromTypeConstructor get_variant_from_type_constructor;
GDExtensionInterfaceGetVariantToTypeConstructor get_variant_to_type_constructor;
GDExtensionInterfaceVariantGetPtrOperatorEvaluator variant_get_ptr_operator_evaluator;
GDExtensionInterfaceVariantGetPtrBuiltinMethod variant_get_ptr_builtin_method;
GDExtensionInterfaceVariantGetPtrConstructor variant_get_ptr_constructor;
GDExtensionInterfaceVariantGetPtrDestructor variant_get_ptr_destructor;
GDExtensionInterfaceVariantConstruct variant_construct;
GDExtensionInterfaceVariantGetPtrSetter variant_get_ptr_setter;
GDExtensionInterfaceVariantGetPtrGetter variant_get_ptr_getter;
GDExtensionInterfaceVariantGetPtrIndexedSetter variant_get_ptr_indexed_setter;
GDExtensionInterfaceVariantGetPtrIndexedGetter variant_get_ptr_indexed_getter;
GDExtensionInterfaceVariantGetPtrKeyedSetter variant_get_ptr_keyed_setter;
GDExtensionInterfaceVariantGetPtrKeyedGetter variant_get_ptr_keyed_getter;
GDExtensionInterfaceVariantGetPtrKeyedChecker variant_get_ptr_keyed_checker;
GDExtensionInterfaceVariantGetConstantValue variant_get_constant_value;
GDExtensionInterfaceVariantGetPtrUtilityFunction variant_get_ptr_utility_function;
GDExtensionInterfaceStringNewWithLatin1Chars string_new_with_latin1_chars;
GDExtensionInterfaceStringNewWithUtf8Chars string_new_with_utf8_chars;
GDExtensionInterfaceStringNewWithUtf16Chars string_new_with_utf16_chars;
GDExtensionInterfaceStringNewWithUtf32Chars string_new_with_utf32_chars;
GDExtensionInterfaceStringNewWithWideChars string_new_with_wide_chars;
GDExtensionInterfaceStringNewWithLatin1CharsAndLen string_new_with_latin1_chars_and_len;
GDExtensionInterfaceStringNewWithUtf8CharsAndLen string_new_with_utf8_chars_and_len;
GDExtensionInterfaceStringNewWithUtf16CharsAndLen string_new_with_utf16_chars_and_len;
GDExtensionInterfaceStringNewWithUtf32CharsAndLen string_new_with_utf32_chars_and_len;
GDExtensionInterfaceStringNewWithWideCharsAndLen string_new_with_wide_chars_and_len;
GDExtensionInterfaceStringToLatin1Chars string_to_latin1_chars;
GDExtensionInterfaceStringToUtf8Chars string_to_utf8_chars;
GDExtensionInterfaceStringToUtf16Chars string_to_utf16_chars;
GDExtensionInterfaceStringToUtf32Chars string_to_utf32_chars;
GDExtensionInterfaceStringToWideChars string_to_wide_chars;
GDExtensionInterfaceStringOperatorIndex string_operator_index;
GDExtensionInterfaceStringOperatorIndexConst string_operator_index_const;
GDExtensionInterfaceStringOperatorPlusEqString string_operator_plus_eq_string;
GDExtensionInterfaceStringOperatorPlusEqChar string_operator_plus_eq_char;
GDExtensionInterfaceStringOperatorPlusEqCstr string_operator_plus_eq_cstr;
GDExtensionInterfaceStringOperatorPlusEqWcstr string_operator_plus_eq_wcstr;
GDExtensionInterfaceStringOperatorPlusEqC32str string_operator_plus_eq_c32str;
GDExtensionInterfaceXmlParserOpenBuffer xml_parser_open_buffer;
GDExtensionInterfaceFileAccessStoreBuffer file_access_store_buffer;
GDExtensionInterfaceFileAccessGetBuffer file_access_get_buffer;
GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask worker_thread_pool_add_native_group_task;
GDExtensionInterfaceWorkerThreadPoolAddNativeTask worker_thread_pool_add_native_task;
GDExtensionInterfacePackedByteArrayOperatorIndex packed_byte_array_operator_index;
GDExtensionInterfacePackedByteArrayOperatorIndexConst packed_byte_array_operator_index_const;
GDExtensionInterfacePackedColorArrayOperatorIndex packed_color_array_operator_index;
GDExtensionInterfacePackedColorArrayOperatorIndexConst packed_color_array_operator_index_const;
GDExtensionInterfacePackedFloat32ArrayOperatorIndex packed_float32_array_operator_index;
GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst packed_float32_array_operator_index_const;
GDExtensionInterfacePackedFloat64ArrayOperatorIndex packed_float64_array_operator_index;
GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst packed_float64_array_operator_index_const;
GDExtensionInterfacePackedInt32ArrayOperatorIndex packed_int32_array_operator_index;
GDExtensionInterfacePackedInt32ArrayOperatorIndexConst packed_int32_array_operator_index_const;
GDExtensionInterfacePackedInt64ArrayOperatorIndex packed_int64_array_operator_index;
GDExtensionInterfacePackedInt64ArrayOperatorIndexConst packed_int64_array_operator_index_const;
GDExtensionInterfacePackedStringArrayOperatorIndex packed_string_array_operator_index;
GDExtensionInterfacePackedStringArrayOperatorIndexConst packed_string_array_operator_index_const;
GDExtensionInterfacePackedVector2ArrayOperatorIndex packed_vector2_array_operator_index;
GDExtensionInterfacePackedVector2ArrayOperatorIndexConst packed_vector2_array_operator_index_const;
GDExtensionInterfacePackedVector3ArrayOperatorIndex packed_vector3_array_operator_index;
GDExtensionInterfacePackedVector3ArrayOperatorIndexConst packed_vector3_array_operator_index_const;
GDExtensionInterfaceArrayOperatorIndex array_operator_index;
GDExtensionInterfaceArrayOperatorIndexConst array_operator_index_const;
GDExtensionInterfaceArrayRef array_ref;
GDExtensionInterfaceArraySetTyped array_set_typed;
GDExtensionInterfaceDictionaryOperatorIndex dictionary_operator_index;
GDExtensionInterfaceDictionaryOperatorIndexConst dictionary_operator_index_const;
GDExtensionInterfaceObjectMethodBindCall object_method_bind_call;
GDExtensionInterfaceObjectMethodBindPtrcall object_method_bind_ptrcall;
GDExtensionInterfaceObjectDestroy object_destroy;
GDExtensionInterfaceGlobalGetSingleton global_get_singleton;
GDExtensionInterfaceObjectGetInstanceBinding object_get_instance_binding;
GDExtensionInterfaceObjectSetInstanceBinding object_set_instance_binding;
GDExtensionInterfaceObjectSetInstance object_set_instance;
GDExtensionInterfaceObjectCastTo object_cast_to;
GDExtensionInterfaceObjectGetInstanceFromId object_get_instance_from_id;
GDExtensionInterfaceObjectGetInstanceId object_get_instance_id;
GDExtensionInterfaceRefGetObject ref_get_object;
GDExtensionInterfaceRefSetObject ref_set_object;
GDExtensionInterfaceScriptInstanceCreate script_instance_create;
GDExtensionInterfaceClassdbConstructObject classdb_construct_object;
GDExtensionInterfaceClassdbGetMethodBind classdb_get_method_bind;
GDExtensionInterfaceClassdbGetClassTag classdb_get_class_tag;
GDExtensionInterfaceClassdbRegisterExtensionClass classdb_register_extension_class;
GDExtensionInterfaceClassdbRegisterExtensionClassMethod classdb_register_extension_class_method;
GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant classdb_register_extension_class_integer_constant;
GDExtensionInterfaceClassdbRegisterExtensionClassProperty classdb_register_extension_class_property;
GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup classdb_register_extension_class_property_group;
GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup classdb_register_extension_class_property_subgroup;
GDExtensionInterfaceClassdbRegisterExtensionClassSignal classdb_register_extension_class_signal;
GDExtensionInterfaceClassdbUnregisterExtensionClass classdb_unregister_extension_class;
GDExtensionInterfaceGetLibraryPath get_library_path;
} LegacyGDExtensionInterface;
static LegacyGDExtensionInterface *legacy_gdextension_interface = nullptr;
#define SETUP_LEGACY_FUNC(m_name, m_type) legacy_gdextension_interface->m_name = (m_type)GDExtension::get_interface_function(#m_name)
void *gdextension_get_legacy_interface() {
if (legacy_gdextension_interface != nullptr) {
return legacy_gdextension_interface;
}
legacy_gdextension_interface = memnew(LegacyGDExtensionInterface);
// Force to 4.0.999 to make it easier to detect this structure.
legacy_gdextension_interface->version_major = 4;
legacy_gdextension_interface->version_minor = 0;
legacy_gdextension_interface->version_patch = 999;
legacy_gdextension_interface->version_string = "Godot Engine v4.0.999.stable.official [000000000]";
SETUP_LEGACY_FUNC(mem_alloc, GDExtensionInterfaceMemAlloc);
SETUP_LEGACY_FUNC(mem_realloc, GDExtensionInterfaceMemRealloc);
SETUP_LEGACY_FUNC(mem_free, GDExtensionInterfaceMemFree);
SETUP_LEGACY_FUNC(print_error, GDExtensionInterfacePrintError);
SETUP_LEGACY_FUNC(print_error_with_message, GDExtensionInterfacePrintErrorWithMessage);
SETUP_LEGACY_FUNC(print_warning, GDExtensionInterfacePrintWarning);
SETUP_LEGACY_FUNC(print_warning_with_message, GDExtensionInterfacePrintWarningWithMessage);
SETUP_LEGACY_FUNC(print_script_error, GDExtensionInterfacePrintScriptError);
SETUP_LEGACY_FUNC(print_script_error_with_message, GDExtensionInterfacePrintScriptErrorWithMessage);
SETUP_LEGACY_FUNC(get_native_struct_size, GDExtensionInterfaceGetNativeStructSize);
SETUP_LEGACY_FUNC(variant_new_copy, GDExtensionInterfaceVariantNewCopy);
SETUP_LEGACY_FUNC(variant_new_nil, GDExtensionInterfaceVariantNewNil);
SETUP_LEGACY_FUNC(variant_destroy, GDExtensionInterfaceVariantDestroy);
SETUP_LEGACY_FUNC(variant_call, GDExtensionInterfaceVariantCall);
SETUP_LEGACY_FUNC(variant_call_static, GDExtensionInterfaceVariantCallStatic);
SETUP_LEGACY_FUNC(variant_evaluate, GDExtensionInterfaceVariantEvaluate);
SETUP_LEGACY_FUNC(variant_set, GDExtensionInterfaceVariantSet);
SETUP_LEGACY_FUNC(variant_set_named, GDExtensionInterfaceVariantSetNamed);
SETUP_LEGACY_FUNC(variant_set_keyed, GDExtensionInterfaceVariantSetKeyed);
SETUP_LEGACY_FUNC(variant_set_indexed, GDExtensionInterfaceVariantSetIndexed);
SETUP_LEGACY_FUNC(variant_get, GDExtensionInterfaceVariantGet);
SETUP_LEGACY_FUNC(variant_get_named, GDExtensionInterfaceVariantGetNamed);
SETUP_LEGACY_FUNC(variant_get_keyed, GDExtensionInterfaceVariantGetKeyed);
SETUP_LEGACY_FUNC(variant_get_indexed, GDExtensionInterfaceVariantGetIndexed);
SETUP_LEGACY_FUNC(variant_iter_init, GDExtensionInterfaceVariantIterInit);
SETUP_LEGACY_FUNC(variant_iter_next, GDExtensionInterfaceVariantIterNext);
SETUP_LEGACY_FUNC(variant_iter_get, GDExtensionInterfaceVariantIterGet);
SETUP_LEGACY_FUNC(variant_hash, GDExtensionInterfaceVariantHash);
SETUP_LEGACY_FUNC(variant_recursive_hash, GDExtensionInterfaceVariantRecursiveHash);
SETUP_LEGACY_FUNC(variant_hash_compare, GDExtensionInterfaceVariantHashCompare);
SETUP_LEGACY_FUNC(variant_booleanize, GDExtensionInterfaceVariantBooleanize);
SETUP_LEGACY_FUNC(variant_duplicate, GDExtensionInterfaceVariantDuplicate);
SETUP_LEGACY_FUNC(variant_stringify, GDExtensionInterfaceVariantStringify);
SETUP_LEGACY_FUNC(variant_get_type, GDExtensionInterfaceVariantGetType);
SETUP_LEGACY_FUNC(variant_has_method, GDExtensionInterfaceVariantHasMethod);
SETUP_LEGACY_FUNC(variant_has_member, GDExtensionInterfaceVariantHasMember);
SETUP_LEGACY_FUNC(variant_has_key, GDExtensionInterfaceVariantHasKey);
SETUP_LEGACY_FUNC(variant_get_type_name, GDExtensionInterfaceVariantGetTypeName);
SETUP_LEGACY_FUNC(variant_can_convert, GDExtensionInterfaceVariantCanConvert);
SETUP_LEGACY_FUNC(variant_can_convert_strict, GDExtensionInterfaceVariantCanConvertStrict);
SETUP_LEGACY_FUNC(get_variant_from_type_constructor, GDExtensionInterfaceGetVariantFromTypeConstructor);
SETUP_LEGACY_FUNC(get_variant_to_type_constructor, GDExtensionInterfaceGetVariantToTypeConstructor);
SETUP_LEGACY_FUNC(variant_get_ptr_operator_evaluator, GDExtensionInterfaceVariantGetPtrOperatorEvaluator);
SETUP_LEGACY_FUNC(variant_get_ptr_builtin_method, GDExtensionInterfaceVariantGetPtrBuiltinMethod);
SETUP_LEGACY_FUNC(variant_get_ptr_constructor, GDExtensionInterfaceVariantGetPtrConstructor);
SETUP_LEGACY_FUNC(variant_get_ptr_destructor, GDExtensionInterfaceVariantGetPtrDestructor);
SETUP_LEGACY_FUNC(variant_construct, GDExtensionInterfaceVariantConstruct);
SETUP_LEGACY_FUNC(variant_get_ptr_setter, GDExtensionInterfaceVariantGetPtrSetter);
SETUP_LEGACY_FUNC(variant_get_ptr_getter, GDExtensionInterfaceVariantGetPtrGetter);
SETUP_LEGACY_FUNC(variant_get_ptr_indexed_setter, GDExtensionInterfaceVariantGetPtrIndexedSetter);
SETUP_LEGACY_FUNC(variant_get_ptr_indexed_getter, GDExtensionInterfaceVariantGetPtrIndexedGetter);
SETUP_LEGACY_FUNC(variant_get_ptr_keyed_setter, GDExtensionInterfaceVariantGetPtrKeyedSetter);
SETUP_LEGACY_FUNC(variant_get_ptr_keyed_getter, GDExtensionInterfaceVariantGetPtrKeyedGetter);
SETUP_LEGACY_FUNC(variant_get_ptr_keyed_checker, GDExtensionInterfaceVariantGetPtrKeyedChecker);
SETUP_LEGACY_FUNC(variant_get_constant_value, GDExtensionInterfaceVariantGetConstantValue);
SETUP_LEGACY_FUNC(variant_get_ptr_utility_function, GDExtensionInterfaceVariantGetPtrUtilityFunction);
SETUP_LEGACY_FUNC(string_new_with_latin1_chars, GDExtensionInterfaceStringNewWithLatin1Chars);
SETUP_LEGACY_FUNC(string_new_with_utf8_chars, GDExtensionInterfaceStringNewWithUtf8Chars);
SETUP_LEGACY_FUNC(string_new_with_utf16_chars, GDExtensionInterfaceStringNewWithUtf16Chars);
SETUP_LEGACY_FUNC(string_new_with_utf32_chars, GDExtensionInterfaceStringNewWithUtf32Chars);
SETUP_LEGACY_FUNC(string_new_with_wide_chars, GDExtensionInterfaceStringNewWithWideChars);
SETUP_LEGACY_FUNC(string_new_with_latin1_chars_and_len, GDExtensionInterfaceStringNewWithLatin1CharsAndLen);
SETUP_LEGACY_FUNC(string_new_with_utf8_chars_and_len, GDExtensionInterfaceStringNewWithUtf8CharsAndLen);
SETUP_LEGACY_FUNC(string_new_with_utf16_chars_and_len, GDExtensionInterfaceStringNewWithUtf16CharsAndLen);
SETUP_LEGACY_FUNC(string_new_with_utf32_chars_and_len, GDExtensionInterfaceStringNewWithUtf32CharsAndLen);
SETUP_LEGACY_FUNC(string_new_with_wide_chars_and_len, GDExtensionInterfaceStringNewWithWideCharsAndLen);
SETUP_LEGACY_FUNC(string_to_latin1_chars, GDExtensionInterfaceStringToLatin1Chars);
SETUP_LEGACY_FUNC(string_to_utf8_chars, GDExtensionInterfaceStringToUtf8Chars);
SETUP_LEGACY_FUNC(string_to_utf16_chars, GDExtensionInterfaceStringToUtf16Chars);
SETUP_LEGACY_FUNC(string_to_utf32_chars, GDExtensionInterfaceStringToUtf32Chars);
SETUP_LEGACY_FUNC(string_to_wide_chars, GDExtensionInterfaceStringToWideChars);
SETUP_LEGACY_FUNC(string_operator_index, GDExtensionInterfaceStringOperatorIndex);
SETUP_LEGACY_FUNC(string_operator_index_const, GDExtensionInterfaceStringOperatorIndexConst);
SETUP_LEGACY_FUNC(string_operator_plus_eq_string, GDExtensionInterfaceStringOperatorPlusEqString);
SETUP_LEGACY_FUNC(string_operator_plus_eq_char, GDExtensionInterfaceStringOperatorPlusEqChar);
SETUP_LEGACY_FUNC(string_operator_plus_eq_cstr, GDExtensionInterfaceStringOperatorPlusEqCstr);
SETUP_LEGACY_FUNC(string_operator_plus_eq_wcstr, GDExtensionInterfaceStringOperatorPlusEqWcstr);
SETUP_LEGACY_FUNC(string_operator_plus_eq_c32str, GDExtensionInterfaceStringOperatorPlusEqC32str);
SETUP_LEGACY_FUNC(xml_parser_open_buffer, GDExtensionInterfaceXmlParserOpenBuffer);
SETUP_LEGACY_FUNC(file_access_store_buffer, GDExtensionInterfaceFileAccessStoreBuffer);
SETUP_LEGACY_FUNC(file_access_get_buffer, GDExtensionInterfaceFileAccessGetBuffer);
SETUP_LEGACY_FUNC(worker_thread_pool_add_native_group_task, GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask);
SETUP_LEGACY_FUNC(worker_thread_pool_add_native_task, GDExtensionInterfaceWorkerThreadPoolAddNativeTask);
SETUP_LEGACY_FUNC(packed_byte_array_operator_index, GDExtensionInterfacePackedByteArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_byte_array_operator_index_const, GDExtensionInterfacePackedByteArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_color_array_operator_index, GDExtensionInterfacePackedColorArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_color_array_operator_index_const, GDExtensionInterfacePackedColorArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_float32_array_operator_index, GDExtensionInterfacePackedFloat32ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_float32_array_operator_index_const, GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_float64_array_operator_index, GDExtensionInterfacePackedFloat64ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_float64_array_operator_index_const, GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_int32_array_operator_index, GDExtensionInterfacePackedInt32ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_int32_array_operator_index_const, GDExtensionInterfacePackedInt32ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_int64_array_operator_index, GDExtensionInterfacePackedInt64ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_int64_array_operator_index_const, GDExtensionInterfacePackedInt64ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_string_array_operator_index, GDExtensionInterfacePackedStringArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_string_array_operator_index_const, GDExtensionInterfacePackedStringArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_vector2_array_operator_index, GDExtensionInterfacePackedVector2ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_vector2_array_operator_index_const, GDExtensionInterfacePackedVector2ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(packed_vector3_array_operator_index, GDExtensionInterfacePackedVector3ArrayOperatorIndex);
SETUP_LEGACY_FUNC(packed_vector3_array_operator_index_const, GDExtensionInterfacePackedVector3ArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(array_operator_index, GDExtensionInterfaceArrayOperatorIndex);
SETUP_LEGACY_FUNC(array_operator_index_const, GDExtensionInterfaceArrayOperatorIndexConst);
SETUP_LEGACY_FUNC(array_ref, GDExtensionInterfaceArrayRef);
SETUP_LEGACY_FUNC(array_set_typed, GDExtensionInterfaceArraySetTyped);
SETUP_LEGACY_FUNC(dictionary_operator_index, GDExtensionInterfaceDictionaryOperatorIndex);
SETUP_LEGACY_FUNC(dictionary_operator_index_const, GDExtensionInterfaceDictionaryOperatorIndexConst);
SETUP_LEGACY_FUNC(object_method_bind_call, GDExtensionInterfaceObjectMethodBindCall);
SETUP_LEGACY_FUNC(object_method_bind_ptrcall, GDExtensionInterfaceObjectMethodBindPtrcall);
SETUP_LEGACY_FUNC(object_destroy, GDExtensionInterfaceObjectDestroy);
SETUP_LEGACY_FUNC(global_get_singleton, GDExtensionInterfaceGlobalGetSingleton);
SETUP_LEGACY_FUNC(object_get_instance_binding, GDExtensionInterfaceObjectGetInstanceBinding);
SETUP_LEGACY_FUNC(object_set_instance_binding, GDExtensionInterfaceObjectSetInstanceBinding);
SETUP_LEGACY_FUNC(object_set_instance, GDExtensionInterfaceObjectSetInstance);
SETUP_LEGACY_FUNC(object_cast_to, GDExtensionInterfaceObjectCastTo);
SETUP_LEGACY_FUNC(object_get_instance_from_id, GDExtensionInterfaceObjectGetInstanceFromId);
SETUP_LEGACY_FUNC(object_get_instance_id, GDExtensionInterfaceObjectGetInstanceId);
SETUP_LEGACY_FUNC(ref_get_object, GDExtensionInterfaceRefGetObject);
SETUP_LEGACY_FUNC(ref_set_object, GDExtensionInterfaceRefSetObject);
SETUP_LEGACY_FUNC(script_instance_create, GDExtensionInterfaceScriptInstanceCreate);
SETUP_LEGACY_FUNC(classdb_construct_object, GDExtensionInterfaceClassdbConstructObject);
SETUP_LEGACY_FUNC(classdb_get_method_bind, GDExtensionInterfaceClassdbGetMethodBind);
SETUP_LEGACY_FUNC(classdb_get_class_tag, GDExtensionInterfaceClassdbGetClassTag);
SETUP_LEGACY_FUNC(classdb_register_extension_class, GDExtensionInterfaceClassdbRegisterExtensionClass);
SETUP_LEGACY_FUNC(classdb_register_extension_class_method, GDExtensionInterfaceClassdbRegisterExtensionClassMethod);
SETUP_LEGACY_FUNC(classdb_register_extension_class_integer_constant, GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant);
SETUP_LEGACY_FUNC(classdb_register_extension_class_property, GDExtensionInterfaceClassdbRegisterExtensionClassProperty);
SETUP_LEGACY_FUNC(classdb_register_extension_class_property_group, GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup);
SETUP_LEGACY_FUNC(classdb_register_extension_class_property_subgroup, GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup);
SETUP_LEGACY_FUNC(classdb_register_extension_class_signal, GDExtensionInterfaceClassdbRegisterExtensionClassSignal);
SETUP_LEGACY_FUNC(classdb_unregister_extension_class, GDExtensionInterfaceClassdbUnregisterExtensionClass);
SETUP_LEGACY_FUNC(get_library_path, GDExtensionInterfaceGetLibraryPath);
return legacy_gdextension_interface;
}
#undef SETUP_LEGACY_FUNC

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@
<return type="int" enum="Error" />
<param index="0" name="path" type="String" />
<param index="1" name="entry_symbol" type="String" />
<param index="2" name="use_legacy_interface" type="bool" />
<description>
</description>
</method>