KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
library.h File Reference

Dynamically loadable library support. More...

#include <sys/cdefs.h>
#include <kos/thread.h>
#include <kos/elf.h>
#include <kos/fs.h>

Go to the source code of this file.

Data Structures

struct  klibrary_t
 Loaded library structure. More...
 

Macros

#define LIBRARY_DEFAULTS   0
 Defaults: no flags.
 

Typedefs

typedef tid_t libid_t
 Library ID type.
 

Functions

klibrary_tlibrary_by_libid (libid_t libid)
 Look up a library by ID.
 
klibrary_tlibrary_create (int flags)
 Create a new library shell.
 
int library_destroy (klibrary_t *lib)
 Destroy a library.
 
klibrary_tlibrary_open (const char *name, const char *fn)
 Try to open a library by name.
 
klibrary_tlibrary_lookup (const char *name)
 Look up a library by name.
 
klibrary_tlibrary_lookup_fn (const char *fn)
 Look up a library by filename.
 
int library_close (klibrary_t *lib)
 Close a previously opened library.
 
libid_t library_get_libid (klibrary_t *lib)
 Retrieve the specified library's runtime-assigned ID.
 
int library_get_refcnt (klibrary_t *lib)
 Retrieve the specified library's reference count.
 
const char * library_get_name (klibrary_t *lib)
 Retrieve the specified library's name.
 
uint32_t library_get_version (klibrary_t *lib)
 Retrieve the specified library's version.
 

Detailed Description

Dynamically loadable library support.

This file contains definitions for accessing loadable libraries at runtime. Each library has a name and a version number that it can be referenced by. One must be careful with these dynamic libraries as there is no private storage per instance, and all memory space is shared.

Libraries can both export and import symbols. Imported symbols may require other libraries to be loaded earlier. Libraries are reference counted so that they can be opened multiple times without actually loading them multiple times, and so that a close will act as expected in situations like this.

Author
Megan Potter
Ruslan Rostovtsev