48 #include <CoreFoundation/CFBundle.h>
49 #include <CoreFoundation/CFString.h>
50 #include <CoreFoundation/CFURL.h>
55 int DYN_LoadLibrary(
void **pvLHandle,
char *pcLibrary)
58 CFStringRef bundlePath;
68 bundlePath = CFStringCreateWithCString(NULL, pcLibrary,
69 kCFStringEncodingMacRoman);
70 if (bundlePath == NULL)
73 bundleURL = CFURLCreateWithFileSystemPath(NULL, bundlePath,
74 kCFURLPOSIXPathStyle, TRUE);
75 CFRelease(bundlePath);
76 if (bundleURL == NULL)
79 bundle = CFBundleCreate(NULL, bundleURL);
83 Log1(PCSC_LOG_ERROR,
"CFBundleCreate");
87 if (!CFBundleLoadExecutable(bundle))
89 Log1(PCSC_LOG_ERROR,
"CFBundleLoadExecutable");
94 *pvLHandle = (
void *) bundle;
99 int DYN_CloseLibrary(
void **pvLHandle)
102 CFBundleRef bundle = (CFBundleRef) * pvLHandle;
104 if (CFBundleIsExecutableLoaded(bundle) == TRUE)
106 CFBundleUnloadExecutable(bundle);
110 Log1(PCSC_LOG_ERROR,
"Cannot unload library.");
116 int DYN_GetAddress(
void *pvLHandle,
void **pvFHandle,
const char *pcFunction,
120 CFBundleRef bundle = (CFBundleRef) pvLHandle;
121 CFStringRef cfName = CFStringCreateWithCString(NULL, pcFunction,
122 kCFStringEncodingMacRoman);
126 *pvFHandle = CFBundleGetFunctionPointerForName(bundle, cfName);
128 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