GATE
Loading...
Searching...
No Matches
libraries.h File Reference

Controls access to shared libraries (DLL or SO) More...

#include "gate/gate_core_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"
#include "gate/objects.h"

Macros

#define GATE_LIBRARY_FLAG_DEFAULT   0x0000
 Library is opened in a platform-default mode.
 
#define GATE_LIBRARY_FLAG_LOCAL   0x0001
 Library is opened in local mode (POSIX), opposite of global mode.
 
#define GATE_LIBRARY_FLAG_DATA   0x0002
 Library is loaded for data symbols only, code functions may not be available.
 

Typedefs

typedef void * gate_library_t
 gate_library_t shared library handle
 
typedef int(* gate_library_function_t) (int)
 gate_library_function_t generic C function used as default datatype for all library functions
 

Functions

GATE_CORE_API gate_result_t gate_library_open (gate_string_t const *path, gate_library_t *lib, gate_uint32_t flags)
 Opens a shared library (DLL or SO) and generates a library handle.
 
GATE_CORE_API gate_result_t gate_library_close (gate_library_t lib)
 
GATE_CORE_API gate_result_t gate_library_get_function (gate_library_t lib, gate_string_t const *entryname, gate_library_function_t *ptr_func)
 Loads a function by its name and returns a pointer to it.
 
GATE_CORE_API gate_result_t gate_library_get_data (gate_library_t lib, gate_string_t const *entryname, void **ptr_data)
 Loads a data value by its name and returns a pointer to it.
 
GATE_CORE_API gate_result_t gate_library_get_function_name (gate_library_t lib, char const *funcname, void *ptr_func)
 Loads a function by its c-string name and returns a pointer to it.
 
GATE_CORE_API gate_result_t gate_library_get_data_name (gate_library_t lib, char const *entryname, void *ptr_data)
 Loads a data value by its c-string name and returns a pointer to it.
 

Detailed Description

Controls access to shared libraries (DLL or SO)

Function Documentation

◆ gate_library_open()

GATE_CORE_API gate_result_t gate_library_open ( gate_string_t const * path,
gate_library_t * lib,
gate_uint32_t flags )

Opens a shared library (DLL or SO) and generates a library handle.

Parameters
pathFile path of library to be opened
libpointer to library handle that receives the result
flagsOpening flag to change library behavior
Returns
value GATE_RESULT_* code

◆ gate_library_close()

GATE_CORE_API gate_result_t gate_library_close ( gate_library_t lib)

Closes an opened library handle

Parameters
libLibrary handle

◆ gate_library_get_function()

GATE_CORE_API gate_result_t gate_library_get_function ( gate_library_t lib,
gate_string_t const * entryname,
gate_library_function_t * ptr_func )

Loads a function by its name and returns a pointer to it.

Parameters
libLibrary handle
entrynameName of function to be loaded
ptr_funcPointer to a location where the function pointer is written to
Returns
value GATE_RESULT_* code

◆ gate_library_get_data()

GATE_CORE_API gate_result_t gate_library_get_data ( gate_library_t lib,
gate_string_t const * entryname,
void ** ptr_data )

Loads a data value by its name and returns a pointer to it.

Parameters
libLibrary handle
entrynameName of data value to be loaded
ptr_dataPointer to a location where the data pointer is written to
Returns
value GATE_RESULT_* code

◆ gate_library_get_function_name()

GATE_CORE_API gate_result_t gate_library_get_function_name ( gate_library_t lib,
char const * funcname,
void * ptr_func )

Loads a function by its c-string name and returns a pointer to it.

Parameters
libLibrary handle
funcnameName of function to be loaded
ptr_funcPointer to a location where the function pointer is written to
Returns
value GATE_RESULT_* code

◆ gate_library_get_data_name()

GATE_CORE_API gate_result_t gate_library_get_data_name ( gate_library_t lib,
char const * entryname,
void * ptr_data )

Loads a data value by its c-string name and returns a pointer to it.

Parameters
libLibrary handle
entrynameName of data value to be loaded
ptr_dataPointer to a location where the data pointer is written to
Returns
value GATE_RESULT_* code