[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KLibLoader broken on OSX
From:       Thiago Macieira <thiago () kde ! org>
Date:       2006-10-07 17:07:52
Message-ID: 200610071907.54293.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Dirk Mueller wrote:
>On Wednesday, 4. October 2006 19:34, Thiago Macieira wrote:
>> QLibrary, which KLibLoader indirectly uses now, already has the
>> extension code. Why is this being duplicated?
>
>Where is that code supposed to be? The code I found doesn't search
> arbitrary KStandardDirs for libraries.

I never said it does. I was talking about the file name's prefix and 
suffix, not about the pathnames.

Attached is a simple testcase to show how it could be implemented in 
KLibLoader, respecting paths, and not making any assumption about 
suffixes, prefixes or how to encode version numbers in pathnames:

The result of running it was:
could not load library "/usr/local/lib/bz2" 
0x0 
could  load library "/usr/lib/libbz2.so" 
0xb7a72640 

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["test.cpp" (text/x-c++src)]

#include <QtCore/QLibrary>
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QStringList>

static const char list[] = "/usr/local/lib/:/usr/lib/";

int main()
{
    QLibrary lib;
    QStringList kdedirs = QFile::decodeName(list).split(':');
    foreach (QString prefix, kdedirs) {    
        lib.setFileName(prefix + "bz2");
        lib.load();
        qDebug() << "could" << (lib.isLoaded() ? "" : "not")
                 << "load library" << lib.fileName();
        qDebug() << lib.resolve("BZ2_decompress");
        if (lib.isLoaded())
            return 0;
    }

    return 1;
}

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic