• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
KLibLoader Class Reference

#include <klibloader.h>

Inherits TQObject.

Public Member Functions

 ~KLibLoader ()
 
KLibFactory * factory (const char *libname)
 
virtual KLibrary * library (const char *libname)
 
KLibrary * globalLibrary (const char *name)
 
TQString lastErrorMessage () const
 
virtual void unloadLibrary (const char *libname)
 

Static Public Member Functions

static KLibLoader * self ()
 
static void cleanUp ()
 
static TQString findLibrary (const char *name, const TDEInstance *instance=TDEGlobal::instance())
 

Protected Member Functions

 KLibLoader (TQObject *parent=0, const char *name=0)
 
virtual void virtual_hook (int id, void *data)
 

Friends

class KLibrary
 

Detailed Description

The KLibLoader allows you to load libraries dynamically at runtime.

Dependent libraries are loaded automatically.

KLibLoader follows the singleton pattern. You can not create multiple instances. Use self() to get a pointer to the loader.

See also
KLibrary
Author
Torben Weis weis@.nosp@m.kde..nosp@m.org

Definition at line 142 of file klibloader.h.

Constructor & Destructor Documentation

◆ ~KLibLoader()

KLibLoader::~KLibLoader ( )

You should NEVER destruct an instance of KLibLoader until you know what you are doing.

This will release the loaded libraries.

Definition at line 318 of file klibloader.cpp.

◆ KLibLoader()

KLibLoader::KLibLoader ( TQObject *  parent = 0,
const char *  name = 0 
)
protected

Definition at line 304 of file klibloader.cpp.

Member Function Documentation

◆ cleanUp()

void KLibLoader::cleanUp ( )
static

Definition at line 295 of file klibloader.cpp.

◆ factory()

KLibFactory * KLibLoader::factory ( const char *  libname)

Loads and initializes a library.

Loading a library multiple times is handled gracefully.

This is a convenience function that returns the factory immediately

Parameters
libnameThis 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 KDE 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.

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.

Returns
the KLibFactory, or 0 if the library does not exist or it does not have a factory
See also
library

Definition at line 478 of file klibloader.cpp.

◆ findLibrary()

TQString KLibLoader::findLibrary ( const char *  name,
const TDEInstance *  instance = TDEGlobal::instance() 
)
static

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.

Parameters
nameof 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.
instancea TDEInstance used to get the standard paths

Definition at line 351 of file klibloader.cpp.

◆ globalLibrary()

KLibrary * KLibLoader::globalLibrary ( const char *  name)

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.

Parameters
nameThis 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 KDE 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.

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.

Returns
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()
See also
factory

Definition at line 376 of file klibloader.cpp.

◆ lastErrorMessage()

TQString KLibLoader::lastErrorMessage ( ) const

Returns an error message that can be useful to debug the problem.

Returns TQString::null if the last call to library() was successful. You can call this function more than once. The error message is only reset by a new call to library().

Returns
the last error message, or TQString::null if there was no error

Definition at line 456 of file klibloader.cpp.

◆ library()

KLibrary * KLibLoader::library ( const char *  libname)
virtual

Loads and initializes a library.

Loading a library multiple times is handled gracefully.

Parameters
libnameThis 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 KDE 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.

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.

Returns
KLibrary is invalid (0) when the library couldn't be dlopened. in such a case you can retrieve the error message by calling KLibLoader::lastErrorMessage()
See also
factory

Definition at line 392 of file klibloader.cpp.

◆ self()

KLibLoader * KLibLoader::self ( )
static

Returns a pointer to the factory.

Use this function to get an instance of KLibLoader.

Returns
a pointer to the loader. If no loader exists until now then one is created.

Definition at line 288 of file klibloader.cpp.

◆ unloadLibrary()

void KLibLoader::unloadLibrary ( const char *  libname)
virtual

Unloads the library with the given name.

Parameters
libnameThis 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 KDE 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.

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.

Definition at line 461 of file klibloader.cpp.

◆ virtual_hook()

void KLibLoader::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 576 of file klibloader.cpp.

Friends And Related Function Documentation

◆ KLibrary

friend class KLibrary
friend

Definition at line 144 of file klibloader.h.


The documentation for this class was generated from the following files:
  • klibloader.h
  • klibloader.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.