25 #include <CoreFoundation/CFBundle.h>
26 #include <CoreFoundation/CFString.h>
27 #include <CoreFoundation/CFURL.h>
32 int DYN_LoadLibrary(
void **pvLHandle,
char *pcLibrary)
35 CFStringRef bundlePath;
45 bundlePath = CFStringCreateWithCString(NULL, pcLibrary,
46 kCFStringEncodingMacRoman);
47 if (bundlePath == NULL)
50 bundleURL = CFURLCreateWithFileSystemPath(NULL, bundlePath,
51 kCFURLPOSIXPathStyle, TRUE);
52 CFRelease(bundlePath);
53 if (bundleURL == NULL)
56 bundle = CFBundleCreate(NULL, bundleURL);
60 Log1(PCSC_LOG_ERROR,
"CFBundleCreate");
64 if (!CFBundleLoadExecutable(bundle))
66 Log1(PCSC_LOG_ERROR,
"CFBundleLoadExecutable");
71 *pvLHandle = (
void *) bundle;
76 int DYN_CloseLibrary(
void **pvLHandle)
79 CFBundleRef bundle = (CFBundleRef) * pvLHandle;
81 if (CFBundleIsExecutableLoaded(bundle) == TRUE)
83 CFBundleUnloadExecutable(bundle);
87 Log1(PCSC_LOG_ERROR,
"Cannot unload library.");
93 int DYN_GetAddress(
void *pvLHandle,
void **pvFHandle,
const char *pcFunction)
96 CFBundleRef bundle = (CFBundleRef) pvLHandle;
97 CFStringRef cfName = CFStringCreateWithCString(NULL, pcFunction,
98 kCFStringEncodingMacRoman);
102 *pvFHandle = CFBundleGetFunctionPointerForName(bundle, cfName);
104 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.
This keeps a list of defines for pcsc-lite.
#define SCARD_E_NO_MEMORY
Not enough memory available to complete this command.
#define SCARD_S_SUCCESS
error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx