kdecore Library API Documentation

KLibrary Class Reference

Represents a dynamically loaded library. More...

#include <klibloader.h>

Inheritance diagram for KLibrary:

QObject List of all members.

Public Member Functions

 KLibrary (const QString &libname, const QString &filename, void *handle)
QString name () const
 Returns the name of the library.

QString fileName () const
 Returns the file name of the library.

KLibFactoryfactory ()
 Returns the factory of the library.

void * symbol (const char *name) const
 Looks up a symbol from the library.

bool hasSymbol (const char *name) const
 Looks up a symbol from the library.

void unload () const
 Unloads the library.


Friends

class KLibLoader
class QAsciiDict< KLibrary >

Detailed Description

Represents a dynamically loaded library.

KLibrary allows you to look up symbols of the shared library.

Author:
Torben Weis <weis@kde.org>

Definition at line 48 of file klibloader.h.


Member Function Documentation

QString KLibrary::name  )  const
 

Returns the name of the library.

Returns:
The name of the library like "libkspread".

Reimplemented from QObject.

Definition at line 130 of file klibloader.cpp.

Referenced by factory(), and unload().

QString KLibrary::fileName  )  const
 

Returns the file name of the library.

Returns:
The filename of the library, for example "/opt/kde2&/lib/libkspread.la"

Definition at line 135 of file klibloader.cpp.

KLibFactory * KLibrary::factory  ) 
 

Returns the factory of the library.

Returns:
The factory of the library if there is any, otherwise 0

Definition at line 140 of file klibloader.cpp.

References QObject::connect(), name(), QCString::sprintf(), and symbol().

Referenced by KLibLoader::factory().

void * KLibrary::symbol const char *  name  )  const
 

Looks up a symbol from the library.

This is a very low level function that you usually don't want to use. Usually you should check using hasSymbol() whether the symbol actually exists, otherwise a warning will be printed.

Parameters:
name the name of the symbol to look up
Returns:
the address of the symbol, or 0 if it does not exist
See also:
hasSymbol

Definition at line 171 of file klibloader.cpp.

Referenced by factory().

bool KLibrary::hasSymbol const char *  name  )  const
 

Looks up a symbol from the library.

This is a very low level function that you usually don't want to use. Unlike symbol(), this method doesn't warn if the symbol doesn't exist, so if the symbol might or might not exist, better use hasSymbol() before symbol().

Parameters:
name the name of the symbol to check
Returns:
true if the symbol exists
Since:
3.1

Definition at line 183 of file klibloader.cpp.

void KLibrary::unload  )  const
 

Unloads the library.

This typically results in the deletion of this object. You should not reference its pointer after calling this function.

Definition at line 189 of file klibloader.cpp.

References QFile::encodeName(), name(), and KLibLoader::unloadLibrary().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:14:51 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001