GDNative export: do not add fake lookup table if static lib is not used
This commit is contained in:
parent
8fff25df09
commit
0e2bc779ed
|
@ -144,7 +144,45 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
|
|||
}
|
||||
}
|
||||
|
||||
// Add symbols for staticaly linked libraries on iOS
|
||||
if (p_features.has("iOS")) {
|
||||
|
||||
bool should_fake_dynamic = false;
|
||||
|
||||
List<String> entry_keys;
|
||||
config->get_section_keys("entry", &entry_keys);
|
||||
|
||||
for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) {
|
||||
String key = E->get();
|
||||
|
||||
Vector<String> tags = key.split(".");
|
||||
|
||||
bool skip = false;
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
bool has_feature = p_features.has(tags[i]);
|
||||
|
||||
if (!has_feature) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String entry_lib_path = config->get_value("entry", key);
|
||||
if (entry_lib_path.begins_with("res://") && entry_lib_path.ends_with(".a")) {
|
||||
// If we find static library that was used for export
|
||||
// we should add a fake loopup table.
|
||||
// In case of dynamic library being used,
|
||||
// this symbols will not cause any issues with library loading.
|
||||
should_fake_dynamic = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (should_fake_dynamic) {
|
||||
// Register symbols in the "fake" dynamic lookup table, because dlsym does not work well on iOS.
|
||||
LibrarySymbol expected_symbols[] = {
|
||||
{ "gdnative_init", true },
|
||||
|
@ -187,6 +225,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
|
|||
add_ios_linker_flags(linker_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void editor_init_callback() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue