.TH "KLibLoader" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KLibLoader \- The KLibLoader allows you to load libraries dynamically at runtime.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <klibloader.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fB~KLibLoader\fP ()"
.br
.ti -1c
.RI "\fBKLibFactory\fP * \fBfactory\fP (const char *libname)"
.br
.ti -1c
.RI "virtual \fBKLibrary\fP * \fBlibrary\fP (const char *libname)"
.br
.ti -1c
.RI "\fBKLibrary\fP * \fBglobalLibrary\fP (const char *\fBname\fP)"
.br
.ti -1c
.RI "\fBQString\fP \fBlastErrorMessage\fP () const "
.br
.ti -1c
.RI "virtual void \fBunloadLibrary\fP (const char *libname)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBKLibLoader\fP * \fBself\fP ()"
.br
.ti -1c
.RI "static void \fBcleanUp\fP ()"
.br
.ti -1c
.RI "static \fBQString\fP \fBfindLibrary\fP (const char *\fBname\fP, const \fBKInstance\fP *instance=KGlobal::instance())"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBKLibLoader\fP (\fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKLibrary\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
The KLibLoader allows you to load libraries dynamically at runtime. 

Dependent libraries are loaded automatically.
.PP
KLibLoader follows the singleton pattern. You can not create multiple instances. Use \fBself()\fP to get a pointer to the loader.
.PP
\fBSee also:\fP
.RS 4
\fBKLibrary\fP 
.RE
.PP
\fBAuthor:\fP
.RS 4
Torben Weis <weis@kde.org> 
.RE
.PP

.PP
Definition at line 142 of file klibloader.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KLibLoader::~\fBKLibLoader\fP ()"
.PP
You should NEVER destruct an instance of KLibLoader until you know what you are doing. 
.PP
This will release the loaded libraries. 
.PP
Definition at line 316 of file klibloader.cpp.
.PP
References QAsciiDictIterator::current(), and endl().
.SH "Member Function Documentation"
.PP 
.SS "\fBKLibFactory\fP * KLibLoader::factory (const char * libname)"
.PP
Loads and initializes a library. 
.PP
Loading a library multiple times is handled gracefully.
.PP
This is a convenience function that returns the factory immediately 
.PP
\fBParameters:\fP
.RS 4
\fIlibname\fP This is the library name without extension. Usually that is something like 'libkspread'. The function will then search for a file named 'libkspread.la' in the \fBKDE\fP library paths. The *.la files are created by libtool and contain important information especially about the libraries dependencies on other shared libs. Loading a 'libfoo.so' could not solve the dependencies problem.
.RE
.PP
You can, however, give a library name ending in '.so' (or whatever is used on your platform), and the library will be loaded without resolving dependencies. Use with caution. 
.PP
\fBReturns:\fP
.RS 4
the \fBKLibFactory\fP, or 0 if the library does not exist or it does not have a factory 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBlibrary\fP 
.RE
.PP

.PP
Definition at line 476 of file klibloader.cpp.
.PP
References KLibrary::factory(), and library().
.SS "\fBKLibrary\fP * KLibLoader::library (const char * libname)\fC [virtual]\fP"
.PP
Loads and initializes a library. 
.PP
Loading a library multiple times is handled gracefully.
.PP
\fBParameters:\fP
.RS 4
\fIlibname\fP This is the library name without extension. Usually that is something like 'libkspread'. The function will then search for a file named 'libkspread.la' in the \fBKDE\fP library paths. The *.la files are created by libtool and contain important information especially about the libraries dependencies on other shared libs. Loading a 'libfoo.so' could not solve the dependencies problem.
.RE
.PP
You can, however, give a library name ending in '.so' (or whatever is used on your platform), and the library will be loaded without resolving dependencies. Use with caution. 
.PP
\fBReturns:\fP
.RS 4
\fBKLibrary\fP is invalid (0) when the library couldn't be dlopened. in such a case you can retrieve the error message by calling KLibLoader::lastErrorMessage()
.RE
.PP
\fBSee also:\fP
.RS 4
\fBfactory\fP 
.RE
.PP

.PP
Definition at line 390 of file klibloader.cpp.
.PP
References QString::arg(), QObject::connect(), QObject::destroyed(), endl(), findLibrary(), QString::fromLatin1(), QAsciiDict::insert(), and QString::isEmpty().
.PP
Referenced by factory(), and globalLibrary().
.SS "\fBKLibrary\fP * KLibLoader::globalLibrary (const char * name)"
.PP
Loads and initializes a library. 
.PP
Loading a library multiple times is handled gracefully. The library is loaded such that the symbols are globally accessible so libraries with dependencies can be loaded sequentially.
.PP
\fBParameters:\fP
.RS 4
\fIname\fP This is the library name without extension. Usually that is something like 'libkspread'. The function will then search for a file named 'libkspread.la' in the \fBKDE\fP library paths. The *.la files are created by libtool and contain important information especially about the libraries dependencies on other shared libs. Loading a 'libfoo.so' could not solve the dependencies problem.
.RE
.PP
You can, however, give a library name ending in '.so' (or whatever is used on your platform), and the library will be loaded without resolving dependencies. Use with caution. 
.PP
\fBReturns:\fP
.RS 4
KLibrariy is invalid (0) when the library couldn't be dlopened. in such a case you can retrieve the error message by calling KLibLoader::lastErrorMessage()
.RE
.PP
\fBSee also:\fP
.RS 4
\fBfactory\fP 
.RE
.PP

.PP
Definition at line 374 of file klibloader.cpp.
.PP
References endl(), and library().
.SS "void KLibLoader::unloadLibrary (const char * libname)\fC [virtual]\fP"
.PP
Unloads the library with the given name. 
.PP
\fBParameters:\fP
.RS 4
\fIlibname\fP This is the library name without extension. Usually that is something like 'libkspread'. The function will then search for a file named 'libkspread.la' in the \fBKDE\fP library paths. The *.la files are created by libtool and contain important information especially about the libraries dependencies on other shared libs. Loading a 'libfoo.so' could not solve the dependencies problem.
.RE
.PP
You can, however, give a library name ending in '.so' (or whatever is used on your platform), and the library will be loaded without resolving dependencies. Use with caution. 
.PP
Definition at line 459 of file klibloader.cpp.
.PP
References QObject::destroyed(), QObject::disconnect(), and QAsciiDict::remove().
.PP
Referenced by KLibrary::unload().
.SS "\fBKLibLoader\fP * KLibLoader::self ()\fC [static]\fP"
.PP
Returns a pointer to the factory. 
.PP
Use this function to get an instance of KLibLoader. 
.PP
\fBReturns:\fP
.RS 4
a pointer to the loader. If no loader exists until now then one is created. 
.RE
.PP

.PP
Definition at line 286 of file klibloader.cpp.
.PP
Referenced by KLibrary::factory(), KLibrary::KLibrary(), and KLibrary::symbol().
.SS "\fBQString\fP KLibLoader::findLibrary (const char * name, const \fBKInstance\fP * instance = \fCKGlobal::instance()\fP)\fC [static]\fP"
.PP
Helper method which looks for a library in the standard paths ('module' and 'lib' resources). 
.PP
Made public for code that doesn't use KLibLoader itself, but still wants to open modules. 
.PP
\fBParameters:\fP
.RS 4
\fIname\fP of the library. If it is not a path, the function searches in the 'module' and 'lib' resources. If there is no extension, '.la' will be appended. 
.br
\fIinstance\fP a \fBKInstance\fP used to get the standard paths 
.RE
.PP

.PP
Definition at line 349 of file klibloader.cpp.
.PP
References QFile::decodeName(), KInstance::dirs(), endl(), KStandardDirs::findResource(), QString::isEmpty(), and QString::left().
.PP
Referenced by library().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
