20 #if defined(HAVE_DLFCN_H) && !defined(HAVE_DL_H) && !defined(__APPLE__)
29 INTERNAL
int DYN_LoadLibrary(
void **pvLHandle,
char *pcLibrary)
32 #ifndef PCSCLITE_STATIC_DRIVER
33 *pvLHandle = dlopen(pcLibrary, RTLD_LAZY);
35 if (*pvLHandle == NULL)
37 Log3(PCSC_LOG_CRITICAL,
"%s: %s", pcLibrary, dlerror());
45 INTERNAL
int DYN_CloseLibrary(
void **pvLHandle)
47 #ifndef PCSCLITE_STATIC_DRIVER
50 ret = dlclose(*pvLHandle);
55 Log2(PCSC_LOG_CRITICAL,
"%s", dlerror());
63 INTERNAL
int DYN_GetAddress(
void *pvLHandle,
void **pvFHandle,
const char *pcFunction)
65 char pcFunctionName[256];
69 (void)snprintf(pcFunctionName,
sizeof(pcFunctionName),
"_%s", pcFunction);
72 #ifndef PCSCLITE_STATIC_DRIVER
73 *pvFHandle = dlsym(pvLHandle, pcFunctionName);
76 if (*pvFHandle == NULL)
77 *pvFHandle = dlsym(pvLHandle, pcFunction);
79 if (*pvFHandle == NULL)
81 Log3(PCSC_LOG_CRITICAL,
"%s: %s", pcFunction, dlerror());