51 #include <CoreFoundation/CFBundle.h>
52 #include <CoreFoundation/CFString.h>
53 #include <CoreFoundation/CFURL.h>
58 int DYN_LoadLibrary(
void **pvLHandle,
char *pcLibrary)
61 CFStringRef bundlePath;
71 bundlePath = CFStringCreateWithCString(NULL, pcLibrary,
72 kCFStringEncodingMacRoman);
73 if (bundlePath == NULL)
76 bundleURL = CFURLCreateWithFileSystemPath(NULL, bundlePath,
77 kCFURLPOSIXPathStyle, TRUE);
78 CFRelease(bundlePath);
79 if (bundleURL == NULL)
82 bundle = CFBundleCreate(NULL, bundleURL);
86 Log1(PCSC_LOG_ERROR,
"CFBundleCreate");
90 if (!CFBundleLoadExecutable(bundle))
92 Log1(PCSC_LOG_ERROR,
"CFBundleLoadExecutable");
97 *pvLHandle = (
void *) bundle;
102 int DYN_CloseLibrary(
void **pvLHandle)
105 CFBundleRef bundle = (CFBundleRef) * pvLHandle;
107 if (CFBundleIsExecutableLoaded(bundle) == TRUE)
109 CFBundleUnloadExecutable(bundle);
113 Log1(PCSC_LOG_ERROR,
"Cannot unload library.");
119 int DYN_GetAddress(
void *pvLHandle,
void **pvFHandle,
const char *pcFunction,
123 CFBundleRef bundle = (CFBundleRef) pvLHandle;
124 CFStringRef cfName = CFStringCreateWithCString(NULL, pcFunction,
125 kCFStringEncodingMacRoman);
129 *pvFHandle = CFBundleGetFunctionPointerForName(bundle, cfName);
131 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