libfastdl
Classes | Macros | Functions
fastdl.h File Reference

libfastdl header file. More...

#include <libgenc/genc_Map.h>
#include <stdint.h>

Classes

struct  fastdl_Symbol
 Struct which contains a function pointer. More...
 
struct  fastdl_Handle
 Struct which holds libdl handle and a map of fastdl_Symbol. More...
 

Macros

#define FASTDL_SYM(handle, symbolName, symbolPointer, ret)
 

Functions

int fastdl_open (struct fastdl_Handle *handle, const char *path, int flag)
 
int fastdl_sym (struct fastdl_Handle *handle, const char *symbolName, void **symbolPointer)
 
int fastdl_close (struct fastdl_Handle *handle)
 
char * fastdl_error ()
 

Detailed Description

libfastdl header file.

Author
Byeonggon Lee

Macro Definition Documentation

§ FASTDL_SYM

#define FASTDL_SYM (   handle,
  symbolName,
  symbolPointer,
  ret 
)
Value:
do { \
struct fastdl_Symbol* symbol = NULL; \
struct fastdl_Symbol* oldSymbol = NULL; \
size_t symbolNameLength = strlen(symbolName); \
GENC_MAP_GET(handle, symbolName, symbolNameLength, &symbol); \
if(symbol != NULL) { \
*(symbolPointer) = symbol->pointer; \
*(ret) = 1; \
break; \
} \
*(symbolPointer) = dlsym((handle)->dlHandle, symbolName); \
if(*(symbolPointer) == NULL) { \
*(ret) = -1; \
break; \
} \
symbol = malloc(sizeof(struct fastdl_Symbol)); \
GENC_MAP_ELEM_INIT(symbol); \
GENC_MAP_ELEM_KEY(symbol) = (const uint8_t*)symbolName; \
GENC_MAP_ELEM_KEY_LENGTH(symbol) = symbolNameLength; \
symbol->pointer = *(symbolPointer); \
GENC_MAP_SET(handle, symbol, &oldSymbol); \
*(ret) = 0; \
} while(0)
Struct which contains a function pointer.
Definition: fastdl.h:20