From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../service/openvr/src/sharedlibtools_public.cpp | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gfx/vr/service/openvr/src/sharedlibtools_public.cpp (limited to 'gfx/vr/service/openvr/src/sharedlibtools_public.cpp') diff --git a/gfx/vr/service/openvr/src/sharedlibtools_public.cpp b/gfx/vr/service/openvr/src/sharedlibtools_public.cpp new file mode 100644 index 0000000000..048512a1de --- /dev/null +++ b/gfx/vr/service/openvr/src/sharedlibtools_public.cpp @@ -0,0 +1,43 @@ +//========= Copyright Valve Corporation ============// +#include "sharedlibtools_public.h" +#include + +#if defined(_WIN32) +#include +#endif + +#if defined(POSIX) +#include +#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 (void*)GetProcAddress( (HMODULE)lib, pchFunctionName ); +#elif defined(POSIX) + return dlsym( lib, pchFunctionName ); +#endif +} + + +void SharedLib_Unload( SharedLibHandle lib ) +{ + if ( !lib ) + return; +#if defined( _WIN32) + FreeLibrary( (HMODULE)lib ); +#elif defined(POSIX) + dlclose( lib ); +#endif +} + + -- cgit v1.2.3