.TH "KLibLoader" 3 "28 Jan 2004" "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
.RI "\fIYou should NEVER destruct an instance of KLibLoader until you know what you are doing. \fP"
.ti -1c
.RI "\fBKLibFactory\fP * \fBfactory\fP (const  char *libname)"
.br
.RI "\fILoads and initializes a library. \fP"
.ti -1c
.RI "virtual \fBKLibrary\fP * \fBlibrary\fP (const  char *libname)"
.br
.RI "\fILoads and initializes a library. \fP"
.ti -1c
.RI "\fBKLibrary\fP * \fBglobalLibrary\fP (const  char *\fBname\fP)"
.br
.RI "\fILoads and initializes a library. \fP"
.ti -1c
.RI "\fBQString\fP \fBlastErrorMessage\fP () const "
.br
.ti -1c
.RI "virtual void \fBunloadLibrary\fP (const  char *libname)"
.br
.RI "\fIUnloads the library with the given name. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKLibLoader\fP * \fBself\fP ()"
.br
.RI "\fIReturns a pointer to the factory. \fP"
.ti -1c
.RI "void \fBcleanUp\fP ()"
.br
.ti -1c
.RI "\fBQString\fP \fBfindLibrary\fP (const  char *\fBname\fP, const  \fBKInstance\fP *instance=KGlobal::instance())"
.br
.RI "\fIHelper method which looks for a library in the standard paths ('module' and 'lib' resources). \fP"
.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
\fBAuthor:\fP
.RS 4
Torben Weis <weis@kde.org> 
.RE
.PP

.PP
Definition at line 140 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. This will release the loaded libraries. Definition at line 319 of file klibloader.cpp.
.PP
References QAsciiDictIterator::current().
.SH "Member Function Documentation"
.PP 
.SS "\fBKLibFactory\fP * KLibLoader::factory (const char * libname)"
.PP
Loads and initializes a library. 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 CARE :) 
.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
Definition at line 476 of file klibloader.cpp.
.PP
References KLibrary::factory(), library(), and KStdAction::name().
.SS "\fBKLibrary\fP * KLibLoader::library (const char * libname)\fC [virtual]\fP"
.PP
Loads and initializes a library. 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 CARE :) 
.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
Definition at line 396 of file klibloader.cpp.
.PP
References QObject::connect(), QPtrListIterator::current(), QObject::destroyed(), findLibrary(), QString::fromLatin1(), QString::isEmpty(), QString::latin1(), and KStdAction::name().
.PP
Referenced by factory(), and globalLibrary().
.SS "\fBKLibrary\fP * KLibLoader::globalLibrary (const char * name)"
.PP
Loads and initializes a library. 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
\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 CARE :) 
.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
Definition at line 380 of file klibloader.cpp.
.PP
References library(), and KStdAction::name().
.SS "void KLibLoader::unloadLibrary (const char * libname)\fC [virtual]\fP"
.PP
Unloads the library with the given name. \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 CARE :) Definition at line 459 of file klibloader.cpp.
.PP
References QObject::destroyed(), and QObject::disconnect().
.PP
Referenced by KLibrary::unload().
.SS "\fBKLibLoader\fP * KLibLoader::self ()\fC [static]\fP"
.PP
Returns a pointer to the factory. 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
Definition at line 289 of file klibloader.cpp.
.PP
Referenced by findLibrary().
.SS "\fBQString\fP KLibLoader::findLibrary (const char * name, const \fBKInstance\fP * instance = KGlobal::instance())\fC [static]\fP"
.PP
Helper method which looks for a library in the standard paths ('module' and 'lib' resources). 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
Definition at line 337 of file klibloader.cpp.
.PP
References QString::arg(), d, KInstance::dirs(), QCString::find(), KStandardDirs::findResource(), QCString::findRev(), KNotifyClient::instance(), QString::isEmpty(), KStdAction::name(), and self().
.PP
Referenced by library().

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