19 void* dlhnd =
nullptr;
20 for (
const auto path : gLibPaths) {
21 dlhnd = dlopen(path, RTLD_LAZY);
28 SkDEBUGF(
"ICU loader: failed to open libicuuc.\n");
34 bool resolved_required_syms =
true;
36 auto resolve_sym = [&](
void* hnd,
const char name[],
bool required =
false) ->
void* {
37 static constexpr int kMinVer = 44,
42 const auto search_to = icu_ver > 0 ? icu_ver : kMaxVer;
43 icu_ver = icu_ver > 0 ? icu_ver : kMinVer;
47 if (
auto* addr = dlsym(dlhnd, sym.c_str())) {
51 if (icu_ver == search_to) {
59 resolved_required_syms =
false;
71 #define SKICU_FUNC(fname) *(void**)(&lib.f_##fname) = resolve_sym(dlhnd, #fname, true);
74 *(
void**)(&lib.f_ubrk_clone_) = resolve_sym(dlhnd,
"ubrk_clone");
75 *(
void**)(&lib.f_ubrk_safeClone_) = resolve_sym(dlhnd,
"ubrk_safeClone");
76 *(
void**)(&lib.f_ubrk_getLocaleByType) = resolve_sym(dlhnd,
"ubrk_getLocaleByType");
78 if (!resolved_required_syms || (!lib.f_ubrk_clone_ && !lib.f_ubrk_safeClone_)) {
79 SkDEBUGF(
"ICU loader: failed to resolve required symbols.");
84 return std::make_unique<SkICULib>(lib);