Created
January 13, 2014 21:35
-
-
Save kmanna/8408614 to your computer and use it in GitHub Desktop.
Why so ugly?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* @brief Create a new libCEC instance. | |
* @param configuration The configuration to pass to libCEC | |
* @param strLib The name of and/or path to libCEC | |
* @return An instance of ICECAdapter or NULL on error. | |
*/ | |
CEC::ICECAdapter *LibCecInitialise(CEC::libcec_configuration *configuration, const char *strLib = NULL) | |
{ | |
if (!g_libCEC) | |
{ | |
#if defined(__APPLE__) | |
g_libCEC = dlopen(strLib ? strLib : "libcec." CEC_LIB_VERSION_MAJOR_STR ".dylib", RTLD_LAZY); | |
#elif defined(__ANDROID__) | |
g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY); | |
#else | |
g_libCEC = dlopen(strLib ? strLib : "libcec.so." CEC_LIB_VERSION_MAJOR_STR, RTLD_LAZY); | |
#endif | |
if (!g_libCEC) | |
{ | |
cout << dlerror() << endl; | |
return NULL; | |
} | |
} | |
typedef void* _LibCecInitialise(CEC::libcec_configuration *); | |
_LibCecInitialise* LibCecInitialise = (_LibCecInitialise*) dlsym(g_libCEC, "CECInitialise"); | |
if (!LibCecInitialise) | |
{ | |
cout << "cannot find CECInitialise" << endl; | |
return NULL; | |
} | |
return (CEC::ICECAdapter*) LibCecInitialise(configuration); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment