KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
klibrary_t Struct Reference

Loaded library structure. More...

#include <kos/library.h>

Public Member Functions

 LIST_ENTRY (klibrary) list
 Library list handle.
 

Data Fields

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

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

◆ LIST_ENTRY()

klibrary_t::LIST_ENTRY ( klibrary )

Library list handle.

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

Field Documentation

◆ flags

uint32 klibrary_t::flags

Library flags.

◆ image

elf_prog_t klibrary_t::image

ELF image for this library.

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

◆ lib_close

int(* klibrary_t::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

◆ lib_get_name

const char *(* klibrary_t::lib_get_name) (void)

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

◆ lib_get_version

uint32(* klibrary_t::lib_get_version) (void)

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

◆ lib_open

int(* klibrary_t::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

libid_t klibrary_t::libid

Library ID (assigned at runtime).

◆ refcnt

int klibrary_t::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: