OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDynamicLibrary.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // LICENSE: MIT
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: Garrett Potts
9 //
10 //*************************************************************************
11 // $Id: ossimDynamicLibrary.h 23380 2015-06-19 16:37:45Z dburken $
12 #ifndef ossimDynamicLibrary_HEADER
13 #define ossimDynamicLibrary_HEADER 1
14 
15 #include <ossim/ossimConfig.h>
17 #include <ossim/base/ossimString.h>
19 
20 
21 #if defined(_WIN32) || defined(__WIN32__)
22 #include <windows.h>
23 #else
24 #include <dlfcn.h>
25 #endif
26 
28 {
29 public:
31  ossimDynamicLibrary(const ossimString& name);
32  virtual ~ossimDynamicLibrary();
33  // return TRUE if the library was loaded successfully
34  bool isLoaded() const { return theLibrary != 0; }
35 
36  // load the library with the given name (full or not), return TRUE on
37  // success
38  bool load(const ossimString& name);
39 
40  bool load();
41  // unload the library, also done automatically in dtor
42  void unload();
43 
44  // load a symbol from the library, return NULL if an error occured or
45  // symbol wasn't found
46  void *getSymbol(const ossimString& name) const;
47 
48  const ossimString& getName()const
49  {
50  return theLibraryName;
51  }
52 
53 protected:
54  // the handle to DLL or NULL
55 #if defined(_WIN32)
56  HINSTANCE theLibrary;
57 #else
58  void* theLibrary;
59 #endif
61 
62 };
63 
64 #endif
65 
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
const ossimString & getName() const
#define OSSIM_DLL