+/*!
+ * @brief Create a new libCEC instance.
+ * @param configuration The configuration to pass to libCEC
+ * @return An instance of ICECAdapter or NULL on error.
+ */
+CEC::ICECAdapter *LibCecInitialise(const CEC::CecAdapterConfiguration &configuration)
+{
+ if (!g_libCEC)
+ {
+#if defined(__APPLE__)
+ g_libCEC = dlopen(strLib ? strLib : "libcec.dylib", RTLD_LAZY);
+#else
+ g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY);
+#endif
+ if (!g_libCEC)
+ {
+#if defined(__APPLE__)
+ cout << "cannot find " << (strLib ? strLib : "libcec.dylib") << dlerror() << endl;
+#else
+ cout << "cannot find " << (strLib ? strLib : "libcec.so") << dlerror() << endl;
+#endif
+ return NULL;
+ }
+ }
+
+ typedef void* _LibCecInitialise(const CEC::CecAdapterConfiguration &);
+ _LibCecInitialise* LibCecInitialise = (_LibCecInitialise*) dlsym(g_libCEC, "CECInitialise");
+ if (!LibCecInitialise)
+ {
+ cout << "cannot find CECInitialise" << endl;
+ return NULL;
+ }
+
+ return (CEC::ICECAdapter*) LibCecInitialise(configuration);
+}
+
+/*!
+ * @brief Destroy an instance of libCEC.
+ * @param device The instance to destroy.
+ */