diff --git a/project/vc9/nvcore/nvcore.vcproj b/project/vc9/nvcore/nvcore.vcproj index 871e896..719e96f 100644 --- a/project/vc9/nvcore/nvcore.vcproj +++ b/project/vc9/nvcore/nvcore.vcproj @@ -290,6 +290,10 @@ RelativePath="..\..\..\src\nvcore\Array.h" > + + @@ -311,11 +315,11 @@ > -#elif NV_OS_XBOX -#include -#else -#include -#endif - - - -void * nvLoadLibrary(const char * name) -{ -#if NV_OS_WIN32 - return (void *)LoadLibraryExA( name, NULL, 0 ); -#elif NV_OS_XBOX - return (void *)LoadLibraryA( name ); -#else - return dlopen(name, RTLD_LAZY); -#endif -} - -void nvUnloadLibrary(void * handle) -{ - nvDebugCheck(handle != NULL); -#if NV_OS_WIN32 || NV_OS_XBOX - FreeLibrary((HMODULE)handle); -#else - dlclose(handle); -#endif -} - -void * nvBindSymbol(void * handle, const char * symbol) -{ -#if NV_OS_WIN32 || NV_OS_XBOX - return (void *)GetProcAddress((HMODULE)handle, symbol); -#else - return (void *)dlsym(handle, symbol); -#endif -} diff --git a/src/nvcore/Library.h b/src/nvcore/Library.h deleted file mode 100644 index 999e662..0000000 --- a/src/nvcore/Library.h +++ /dev/null @@ -1,51 +0,0 @@ -// This code is in the public domain -- castano@gmail.com - -#pragma once -#ifndef NV_CORE_LIBRARY_H -#define NV_CORE_LIBRARY_H - -#include "nvcore.h" - -#if NV_OS_WIN32 -#define LIBRARY_NAME(name) #name ".dll" -#elif NV_OS_DARWIN -#define NV_LIBRARY_NAME(name) "lib" #name ".dylib" -#else -#define NV_LIBRARY_NAME(name) "lib" #name ".so" -#endif - -NVCORE_API void * nvLoadLibrary(const char * name); -NVCORE_API void nvUnloadLibrary(void * lib); -NVCORE_API void * nvBindSymbol(void * lib, const char * symbol); - -class NVCORE_CLASS Library -{ -public: - Library(const char * name) - { - handle = nvLoadLibrary(name); - } - ~Library() - { - if (isValid()) - { - nvUnloadLibrary(handle); - } - } - - bool isValid() const - { - return handle != NULL; - } - - void * bindSymbol(const char * symbol) - { - return nvBindSymbol(handle, symbol); - } - -private: - void * handle; -}; - - -#endif // NV_CORE_LIBRARY_H