static void* AppleCLGetProcAddress(const char* name) { static bool initialized = false; static void* handle = NULL; if (!handle && !initialized) { cv::AutoLock lock(cv::getInitializationMutex()); if (!initialized) { const char* defaultPath = "/System/Library/Frameworks/OpenCL.framework/Versions/Current/OpenCL"; const char* path = getRuntimePath(defaultPath); if (path) handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL); if (handle == NULL) { if (path != NULL && path != defaultPath) fprintf(stderr, ERROR_MSG_CANT_LOAD); } else if (dlsym(handle, OPENCL_FUNC_TO_CHECK_1_1) == NULL) { fprintf(stderr, ERROR_MSG_INVALID_VERSION); handle = NULL; } initialized = true; } } if (!handle) return NULL; return dlsym(handle, name); }
static void* WinGetProcAddress(const char* name) { static bool initialized = false; static HMODULE handle = NULL; if (!handle && !initialized) { cv::AutoLock lock(cv::getInitializationMutex()); if (!initialized) { handle = GetModuleHandleA("OpenCL.dll"); if (!handle) { const char* defaultPath = "OpenCL.dll"; const char* path = getRuntimePath(defaultPath); if (path) handle = LoadLibraryA(path); if (!handle) { if (path != NULL && path != defaultPath) fprintf(stderr, ERROR_MSG_CANT_LOAD); } else if (GetProcAddress(handle, OPENCL_FUNC_TO_CHECK_1_1) == NULL) { fprintf(stderr, ERROR_MSG_INVALID_VERSION); FreeLibrary(handle); handle = NULL; } } initialized = true; } } if (!handle) return NULL; return (void*)GetProcAddress(handle, name); }
static void* GetProcAddress(const char* name) { static bool initialized = false; static void* handle = NULL; if (!handle && !initialized) { cv::AutoLock lock(cv::getInitializationMutex()); if (!initialized) { const char* defaultPath = "libOpenCL.so"; const char* path = getRuntimePath(defaultPath); if (path) { handle = GetHandle(path); if (!handle) { if (path == defaultPath) handle = GetHandle("libOpenCL.so.1"); else fprintf(stderr, ERROR_MSG_CANT_LOAD); } } initialized = true; } } if (!handle) return NULL; return dlsym(handle, name); }
/** * setFilePaths - set paths for image used within gMTP * @param argc * @param argv */ void setFilePaths(int argc, char *argv[]) { // Get our executable location. applicationpath = getRuntimePath(argc, argv); // Set our image locations. file_logo_png = g_strdup_printf("%s/../share/gmtp/logo.png", applicationpath); file_icon48_png = g_strdup_printf("%s/../share/gmtp/gmtpicon.png", applicationpath); file_icon16_png = g_strdup_printf("%s/../share/gmtp/icon-16.png", applicationpath); file_about_png = g_strdup_printf("%s/../share/gmtp/stock-about-16.png", applicationpath); file_format_png = g_strdup_printf("%s/../share/gmtp/view-refresh.png", applicationpath); file_audio_png = g_strdup_printf("%s/../share/gmtp/audio-x-mpeg.png", applicationpath); file_video_png = g_strdup_printf("%s/../share/gmtp/video-x-generic.png", applicationpath); file_playlist_png = g_strdup_printf("%s/../share/gmtp/audio-x-mp3-playlist.png", applicationpath); file_album_png = g_strdup_printf("%s/../share/gmtp/media-cdrom-audio.png", applicationpath); file_textfile_png = g_strdup_printf("%s/../share/gmtp/text-plain.png", applicationpath); file_generic_png = g_strdup_printf("%s/../share/gmtp/empty.png", applicationpath); file_folder_png = g_strdup_printf("%s/../share/gmtp/folder.png", applicationpath); file_image_png = g_strdup_printf("%s/../share/gmtp/image-x-generic.png", applicationpath); } // end setFilePaths()