|
@@ -359,7 +359,7 @@ void debug_dynamic_library_check_dependencies(const String &p_root_path, const S
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path, bool p_generate_temp_files, PackedStringArray *p_library_dependencies) {
|
|
|
+Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data) {
|
|
|
String path = p_path.replace("/", "\\");
|
|
|
|
|
|
if (!FileAccess::exists(path)) {
|
|
@@ -371,7 +371,7 @@ Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_ha
|
|
|
|
|
|
// Here we want a copy to be loaded.
|
|
|
// This is so the original file isn't locked and can be updated by a compiler.
|
|
|
- if (p_generate_temp_files) {
|
|
|
+ if (p_data != nullptr && p_data->generate_temp_files) {
|
|
|
// Copy the file to the same directory as the original with a prefix in the name.
|
|
|
// This is so relative path to dependencies are satisfied.
|
|
|
String copy_path = path.get_base_dir().path_join("~" + path.get_file());
|
|
@@ -407,13 +407,13 @@ Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_ha
|
|
|
bool has_dll_directory_api = ((add_dll_directory != nullptr) && (remove_dll_directory != nullptr));
|
|
|
DLL_DIRECTORY_COOKIE cookie = nullptr;
|
|
|
|
|
|
- if (p_also_set_library_path && has_dll_directory_api) {
|
|
|
+ if (p_data != nullptr && p_data->also_set_library_path && has_dll_directory_api) {
|
|
|
cookie = add_dll_directory((LPCWSTR)(path.get_base_dir().utf16().get_data()));
|
|
|
}
|
|
|
|
|
|
- p_library_handle = (void *)LoadLibraryExW((LPCWSTR)(path.utf16().get_data()), nullptr, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
|
|
|
+ p_library_handle = (void *)LoadLibraryExW((LPCWSTR)(path.utf16().get_data()), nullptr, (p_data != nullptr && p_data->also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
|
|
|
if (!p_library_handle) {
|
|
|
- if (p_generate_temp_files) {
|
|
|
+ if (p_data != nullptr && p_data->generate_temp_files) {
|
|
|
DirAccess::remove_absolute(path);
|
|
|
}
|
|
|
|
|
@@ -446,11 +446,11 @@ Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_ha
|
|
|
remove_dll_directory(cookie);
|
|
|
}
|
|
|
|
|
|
- if (r_resolved_path != nullptr) {
|
|
|
- *r_resolved_path = path;
|
|
|
+ if (p_data != nullptr && p_data->r_resolved_path != nullptr) {
|
|
|
+ *p_data->r_resolved_path = path;
|
|
|
}
|
|
|
|
|
|
- if (p_generate_temp_files) {
|
|
|
+ if (p_data != nullptr && p_data->generate_temp_files) {
|
|
|
temp_libraries[p_library_handle] = path;
|
|
|
}
|
|
|
|