Save bitmaps as PNG
[lsnes.git] / include / library / loadlib.hpp
blob940389b09e3c22460346268e731c5a5a13da4718
1 #ifndef _library__loadlib__hpp__included__
2 #define _library__loadlib__hpp__included__
4 #include <string>
5 #include <stdexcept>
7 #if defined(_WIN32) || defined(_WIN64)
8 #include <windows.h>
9 #endif
11 /**
12 * A loaded library.
14 class loaded_library
16 public:
17 /**
18 * Load a new library.
20 * Parameter filename: The name of file.
21 * Throws std::bad_alloc: Not enough memory.
22 * Throws std::runtime_error: Error loading shared library.
24 loaded_library(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
25 /**
26 * Unload a library.
28 ~loaded_library() throw();
29 /**
30 * Look up a symbol.
32 * Parameter symbol: The symbol to look up.
33 * Returns: The symbol value.
34 * Throws std::bad_alloc: Not enough memory.
35 * Throws std::runtime_error: Error looking up the symbol.
37 void* operator[](const std::string& symbol) throw(std::bad_alloc, std::runtime_error);
38 /**
39 * See what libraries are called on this platform.
41 * Returns: The name of library.
43 static const std::string& call_library() throw();
44 /**
45 * See what standard library extension is on this platform.
47 * Returns: The extension of library.
49 static const std::string& call_library_ext() throw();
50 private:
51 loaded_library(const loaded_library&);
52 loaded_library& operator=(const loaded_library&);
53 #if defined(_WIN32) || defined(_WIN64)
54 HMODULE handle;
55 #elif !defined(NO_DLFCN)
56 void* handle;
57 #endif
60 #endif