46#include <CoreFoundation/CFBundle.h>
47#include <CoreFoundation/CFString.h>
48#include <CoreFoundation/CFURL.h>
53void * DYN_LoadLibrary(
const char *pcLibrary)
56 CFStringRef bundlePath;
66 bundlePath = CFStringCreateWithCString(NULL, pcLibrary,
67 kCFStringEncodingMacRoman);
68 if (bundlePath == NULL)
71 bundleURL = CFURLCreateWithFileSystemPath(NULL, bundlePath,
72 kCFURLPOSIXPathStyle, TRUE);
73 CFRelease(bundlePath);
74 if (bundleURL == NULL)
77 bundle = CFBundleCreate(NULL, bundleURL);
81 Log1(PCSC_LOG_ERROR,
"CFBundleCreate");
85 if (!CFBundleLoadExecutable(bundle))
87 Log1(PCSC_LOG_ERROR,
"CFBundleLoadExecutable");
92 pvLHandle = (
void *) bundle;
97int DYN_CloseLibrary(
void *pvLHandle)
100 CFBundleRef bundle = (CFBundleRef) pvLHandle;
102 if (CFBundleIsExecutableLoaded(bundle) == TRUE)
104 CFBundleUnloadExecutable(bundle);
108 Log1(PCSC_LOG_ERROR,
"Cannot unload library.");
113int DYN_GetAddress(
void *pvLHandle,
void **pvFHandle,
const char *pcFunction,
118 CFBundleRef bundle = (CFBundleRef) pvLHandle;
119 CFStringRef cfName = CFStringCreateWithCString(NULL, pcFunction,
120 kCFStringEncodingMacRoman);
124 *pvFHandle = CFBundleGetFunctionPointerForName(bundle, cfName);
126 if (*pvFHandle == NULL)
This abstracts dynamic library loading functions.
#define SCARD_F_UNKNOWN_ERROR
An internal error has been detected, but the source is unknown.
#define SCARD_S_SUCCESS
No error was encountered.
#define SCARD_E_NO_MEMORY
Not enough memory available to complete this command.
This keeps a list of defines for pcsc-lite.