From kde-core-devel Sat Oct 07 17:07:52 2006 From: Thiago Macieira Date: Sat, 07 Oct 2006 17:07:52 +0000 To: kde-core-devel Subject: Re: KLibLoader broken on OSX Message-Id: <200610071907.54293.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=116024091427640 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart3478185.uV509hxzxz" --nextPart3478185.uV509hxzxz Content-Type: multipart/mixed; boundary="Boundary-01=_q79JFqpjAFK7QAm" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_q79JFqpjAFK7QAm Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=20 suffix, not about the pathnames. Attached is a simple testcase to show how it could be implemented in=20 KLibLoader, respecting paths, and not making any assumption about=20 suffixes, prefixes or how to encode version numbers in pathnames: The result of running it was: could not load library "/usr/local/lib/bz2"=20 0x0=20 could load library "/usr/lib/libbz2.so"=20 0xb7a72640=20 =2D-=20 =A0 Thiago Macieira =A0- =A0thiago (AT) macieira.info - thiago (AT) kde.org =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --Boundary-01=_q79JFqpjAFK7QAm Content-Type: text/x-c++src; charset="iso-8859-1"; name="test.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="test.cpp" #include #include #include #include static const char list[] =3D "/usr/local/lib/:/usr/lib/"; int main() { QLibrary lib; QStringList kdedirs =3D QFile::decodeName(list).split(':'); foreach (QString prefix, kdedirs) { =20 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; } --Boundary-01=_q79JFqpjAFK7QAm-- --nextPart3478185.uV509hxzxz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBFJ97qM/XwBW70U1gRAtn2AKCtaTH03eOsE52Ecx5n0TDyVdAYAACfWCvo kc3h5mMrwk5z75DxPkTeUX0= =oGnL -----END PGP SIGNATURE----- --nextPart3478185.uV509hxzxz--