示例#1
0
static void resolveLibrary()
{
#ifndef QT_NO_LIBRARY
    QLibrary lib(QLatin1String("resolv"));
    if (!lib.load())
        return;

    local_res_init = res_init_proto(lib.resolve("__res_init"));
    if (!local_res_init)
        local_res_init = res_init_proto(lib.resolve("res_init"));

    local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
    if (!local_res_ninit)
        local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));

    if (!local_res_ninit) {
        // if we can't get a thread-safe context, we have to use the global _res state
        local_res = res_state_ptr(lib.resolve("_res"));
    } else {
        local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
        if (!local_res_nclose)
            local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
        if (!local_res_nclose)
            local_res_ninit = 0;
    }
#endif
}
示例#2
0
static void resolveLibrary()
{
#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX)
    QLibrary lib(QLatin1String("resolv"));
    lib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
    if (!lib.load())
        return;

    local_res_init = res_init_proto(lib.resolve("__res_init"));
    if (!local_res_init)
        local_res_init = res_init_proto(lib.resolve("res_init"));

    local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
    if (!local_res_ninit)
        local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));

    if (!local_res_ninit) {
        // if we can't get a thread-safe context, we have to use the global _res state
        local_res = res_state_ptr(lib.resolve("_res"));
    } else {
        local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
        if (!local_res_nclose)
            local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
        if (!local_res_nclose)
            local_res_ninit = 0;
    }
#endif
}
示例#3
0
static void resolveLibrary()
{
    QLibrary lib;
#ifdef LIBRESOLV_SO
    lib.setFileName(QStringLiteral(LIBRESOLV_SO));
    if (!lib.load())
#endif
    {
        lib.setFileName(QLatin1String("resolv"));
        if (!lib.load())
            return;
    }

    local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));
    if (!local_dn_expand)
        local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));

    local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
    if (!local_res_nclose)
        local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
    if (!local_res_nclose)
        local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));

    local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
    if (!local_res_ninit)
        local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
    if (!local_res_ninit)
        local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));

    local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery"));
    if (!local_res_nquery)
        local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
    if (!local_res_nquery)
        local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
}
示例#4
0
static bool resolveLibraryInternal()
{
#if QT_CONFIG(library) && !defined(Q_OS_QNX)
    QLibrary lib;
#ifdef LIBRESOLV_SO
    lib.setFileName(QStringLiteral(LIBRESOLV_SO));
    if (!lib.load())
#endif
    {
        lib.setFileName(QLatin1String("resolv"));
        if (!lib.load())
            return false;
    }

    local_res_init = res_init_proto(lib.resolve("__res_init"));
    if (!local_res_init)
        local_res_init = res_init_proto(lib.resolve("res_init"));

    local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
    if (!local_res_ninit)
        local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));

    if (!local_res_ninit) {
        // if we can't get a thread-safe context, we have to use the global _res state
        local_res = res_state_ptr(lib.resolve("_res"));
    } else {
        local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
        if (!local_res_nclose)
            local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
        if (!local_res_nclose)
            local_res_ninit = 0;
    }
#endif

    return true;
}