From ebbd03c114e01b087f53e9117ccd12b03421295d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 10 Mar 2003 11:57:17 +0000 Subject: [PATCH] Marged new getLibaryMethod added by Daniel. --- include/osgDB/DynamicLibrary | 3 ++ src/osgDB/DynamicLibrary.cpp | 75 ++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/include/osgDB/DynamicLibrary b/include/osgDB/DynamicLibrary index ecdb87a37..e8841fce9 100644 --- a/include/osgDB/DynamicLibrary +++ b/include/osgDB/DynamicLibrary @@ -51,6 +51,9 @@ class OSGDB_EXPORT DynamicLibrary : public osg::Referenced protected: + /** get handle to library file */ + static HANDLE getLibraryHandle( const std::string& libraryName); + /** disallow default constructor.*/ DynamicLibrary():osg::Referenced() {} /** disallow copy constructor.*/ diff --git a/src/osgDB/DynamicLibrary.cpp b/src/osgDB/DynamicLibrary.cpp index b4c6f164d..c6af59712 100644 --- a/src/osgDB/DynamicLibrary.cpp +++ b/src/osgDB/DynamicLibrary.cpp @@ -62,39 +62,74 @@ DynamicLibrary::~DynamicLibrary() DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName) { + HANDLE handle = NULL; + + +/* +// Daniel's proposed version. + // try letting the OS find the library first + handle = getLibraryHandle( libraryName ); + if (handle) return new DynamicLibrary(libraryName,handle); + + // else try to locate it ourselves std::string fullLibraryName = osgDB::findLibraryFile(libraryName); if (fullLibraryName.empty()) return NULL; + handle = getLibraryHandle( fullLibraryName ); + if (handle) return new DynamicLibrary(libraryName,handle); + + notify(WARN) + << "DynamicLibrary::failed loading "<