KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Data Fields
klibrary Struct Reference

Loaded library structure. More...

#include <kos/library.h>

Public Member Functions

 LIST_ENTRY (klibrary) list
 Library list handle. More...
 

Data Fields

libid_t libid
 Library ID (assigned at runtime). More...
 
uint32 flags
 Library flags. More...
 
elf_prog_t image
 ELF image for this library. More...
 
int refcnt
 Library reference count. More...
 
const char *(* lib_get_name )()
 Retrieve the library's symbolic name. More...
 
uint32(* lib_get_version )()
 Retrieve the library's version. More...
 
int(* lib_open )(struct klibrary *lib)
 Open a library. More...
 
int(* lib_close )(struct klibrary *lib)
 Close an opened library. More...
 

Detailed Description

Loaded library structure.

This structure represents a single loaded library. Each library is essentially a loaded binary of code and a set of exported entry points that are standardized.

Each loaded library should export at least the functions described in this structure:

You should not modify any members of this structure yourself (except if you are implementing a library).

Member Function Documentation

klibrary::LIST_ENTRY ( klibrary  )

Library list handle.

Contrary to what doxygen might think, this is not a function.

Field Documentation

uint32 klibrary::flags

Library flags.

elf_prog_t klibrary::image

ELF image for this library.

This can be used to look up additional entry points in the library.

int(* klibrary::lib_close)(struct klibrary *lib)

Close an opened library.

This function must be implemented by all loadable libraries to close and deinitialize a library. If the library's reference count is > 1 when this function is called, this may involve simply decrementing the reference count.

Parameters
libThe library structure
Returns
Values >= 0 indicate success, < 0 indicates failure
const char*(* klibrary::lib_get_name)()

Retrieve the library's symbolic name.

This function must be implemented by all loadable libraries to fetch the library's symbolic name. This function must work before calling lib_open() on the library.

Returns
The library's symbolic name
uint32(* klibrary::lib_get_version)()

Retrieve the library's version.

This function must be implemented by all loadble libraries to fetch the library's version number. This function must work before calling lib_open() on the library.

Returns
The library's version number
int(* klibrary::lib_open)(struct klibrary *lib)

Open a library.

This function must be implemented by all loadable libraries to initialize the library on load. If the library is already opened, this may only involve increasing the reference count.

Parameters
libThe library structure
Returns
Values >= 0 indicate success, < 0 indicates failure. A failure on the first lib_open is indicative that the library should be removed from memory.
libid_t klibrary::libid

Library ID (assigned at runtime).

int klibrary::refcnt

Library reference count.

This value is incremented every time the library is opened, and decremented each time it is closed. Once the library's reference count hits 0, a close will actually destroy the library.


The documentation for this struct was generated from the following file: