diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/vr/service/openvr/src/sharedlibtools_public.cpp | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/vr/service/openvr/src/sharedlibtools_public.cpp')
-rw-r--r-- | gfx/vr/service/openvr/src/sharedlibtools_public.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
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 <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 (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 +} + + |