Skip to content

Commit

Permalink
[iOS] Fix loading of GDExtension dylibs auto converted to framework.
Browse files Browse the repository at this point in the history
(cherry picked from commit ad4d565)
  • Loading branch information
bruvzg authored and akien-mga committed May 12, 2023
1 parent 268b60d commit ebaf3cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions platform/ios/os_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,21 @@ void register_dynamic_symbol(char *name, void *address) {
path = get_framework_executable(get_executable_path().get_base_dir().path_join(p_path.get_file()));
}

if (!FileAccess::exists(path)) {
// Load .dylib converted to framework from within the executable path.
path = get_framework_executable(get_executable_path().get_base_dir().path_join(p_path.get_file().get_basename() + ".framework"));
}

if (!FileAccess::exists(path)) {
// Load .dylib or framework from a standard iOS location.
path = get_framework_executable(get_executable_path().get_base_dir().path_join("Frameworks").path_join(p_path.get_file()));
}

if (!FileAccess::exists(path)) {
// Load .dylib converted to framework from a standard iOS location.
path = get_framework_executable(get_executable_path().get_base_dir().path_join("Frameworks").path_join(p_path.get_file().get_basename() + ".framework"));
}

p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");

Expand Down

0 comments on commit ebaf3cc

Please sign in to comment.