3131#ifndef GDEXTENSION_H
3232#define GDEXTENSION_H
3333
34- #include < functional>
35-
3634#include " core/extension/gdextension_interface.h"
35+ #include " core/extension/gdextension_loader.h"
3736#include " core/io/config_file.h"
3837#include " core/io/resource_loader.h"
3938#include " core/object/ref_counted.h"
40- #include " core/os/shared_object.h"
4139
4240class GDExtensionMethodBind ;
4341
@@ -46,8 +44,8 @@ class GDExtension : public Resource {
4644
4745 friend class GDExtensionManager ;
4846
49- void *library = nullptr ; // pointer if valid,
50- String library_path;
47+ Ref<GDExtensionLoader> loader;
48+
5149 bool reloadable = false ;
5250
5351 struct Extension {
@@ -98,8 +96,6 @@ class GDExtension : public Resource {
9896 int32_t level_initialized = -1 ;
9997
10098#ifdef TOOLS_ENABLED
101- uint64_t resource_last_modified_time = 0 ;
102- uint64_t library_last_modified_time = 0 ;
10399 bool is_reloading = false ;
104100 Vector<GDExtensionMethodBind *> invalid_methods;
105101 Vector<ObjectID> instance_bindings;
@@ -126,11 +122,12 @@ class GDExtension : public Resource {
126122 virtual bool editor_can_reload_from_file () override { return false ; } // Reloading is handled in a special way.
127123
128124 static String get_extension_list_config_file ();
129- static String find_extension_library (const String &p_path, Ref<ConfigFile> p_config, std::function<bool (String)> p_has_feature, PackedStringArray *r_tags = nullptr);
130- static Vector<SharedObject> find_extension_dependencies (const String &p_path, Ref<ConfigFile> p_config, std::function<bool (String)> p_has_feature);
131125
132- Error open_library (const String &p_path, const String &p_entry_symbol, Vector<SharedObject> *p_dependencies = nullptr );
126+ const Ref<GDExtensionLoader> get_loader () const { return loader; }
127+
128+ Error open_library (const String &p_path, const Ref<GDExtensionLoader> &p_loader);
133129 void close_library ();
130+ bool is_library_open () const ;
134131
135132 enum InitializationLevel {
136133 INITIALIZATION_LEVEL_CORE = GDEXTENSION_INITIALIZATION_CORE,
@@ -148,17 +145,11 @@ class GDExtension : public Resource {
148145#endif
149146
150147public:
151- bool is_library_open () const ;
152-
153148#ifdef TOOLS_ENABLED
154149 bool is_reloadable () const { return reloadable; }
155150 void set_reloadable (bool p_reloadable) { reloadable = p_reloadable; }
156151
157152 bool has_library_changed () const ;
158- void update_last_modified_time (uint64_t p_resource_last_modified_time, uint64_t p_library_last_modified_time) {
159- resource_last_modified_time = p_resource_last_modified_time;
160- library_last_modified_time = p_library_last_modified_time;
161- }
162153
163154 void track_instance_binding (Object *p_object);
164155 void untrack_instance_binding (Object *p_object);
0 commit comments