Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/openvr/src/src/vrcommon/sharedlibtools_public.cpp

Issue 2754253003: Add OpenVR SDK to third_party (Closed)
Patch Set: feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/openvr/src/src/vrcommon/sharedlibtools_public.cpp
diff --git a/third_party/openvr/src/src/vrcommon/sharedlibtools_public.cpp b/third_party/openvr/src/src/vrcommon/sharedlibtools_public.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b88c2986f66f533e3c7a5e0621995660f47a0cfc
--- /dev/null
+++ b/third_party/openvr/src/src/vrcommon/sharedlibtools_public.cpp
@@ -0,0 +1,41 @@
+//========= Copyright Valve Corporation ============//
+#include "sharedlibtools_public.h"
+#include <string.h>
+
+#if defined(_WIN32)
+#include <Windows.h>
+#endif
+
+#if defined(POSIX)
+#include <dlfcn.h>
+#endif
+
+SharedLibHandle SharedLib_Load( const char *pchPath )
+{
+#if defined( _WIN32)
+ return (SharedLibHandle)LoadLibraryEx( pchPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
+#elif defined(POSIX)
+ return (SharedLibHandle)dlopen(pchPath, RTLD_LOCAL|RTLD_NOW);
+#endif
+}
+
+void *SharedLib_GetFunction( SharedLibHandle lib, const char *pchFunctionName)
+{
+#if defined( _WIN32)
+ return GetProcAddress( (HMODULE)lib, pchFunctionName );
+#elif defined(POSIX)
+ return dlsym( lib, pchFunctionName );
+#endif
+}
+
+
+void SharedLib_Unload( SharedLibHandle lib )
+{
+#if defined( _WIN32)
+ FreeLibrary( (HMODULE)lib );
+#elif defined(POSIX)
+ dlclose( lib );
+#endif
+}
+
+
« no previous file with comments | « third_party/openvr/src/src/vrcommon/sharedlibtools_public.h ('k') | third_party/openvr/src/src/vrcommon/strtools_public.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698