1 ////////////////////////////////////////////////////////////
\r
3 // Pluma - Plug-in Management Framework
\r
4 // Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
\r
6 // This software is provided 'as-is', without any express or implied warranty.
\r
7 // In no event will the authors be held liable for any damages arising from the use of this software.
\r
9 // Permission is granted to anyone to use this software for any purpose,
\r
10 // including commercial applications, and to alter it and redistribute it freely,
\r
11 // subject to the following restrictions:
\r
13 // 1. The origin of this software must not be misrepresented;
\r
14 // you must not claim that you wrote the original software.
\r
15 // If you use this software in a product, an acknowledgment
\r
16 // in the product documentation would be appreciated but is not required.
\r
18 // 2. Altered source versions must be plainly marked as such,
\r
19 // and must not be misrepresented as being the original software.
\r
21 // 3. This notice may not be removed or altered from any source distribution.
\r
23 ////////////////////////////////////////////////////////////
\r
25 #ifndef PLUMA_DYNAMIC_LIBRARY_HPP
\r
26 #define PLUMA_DYNAMIC_LIBRARY_HPP
\r
28 ////////////////////////////////////////////////////////////
\r
30 ////////////////////////////////////////////////////////////
\r
31 #include <Pluma/Config.hpp>
\r
34 // include OS dependent support for DLL
\r
35 #ifdef PLUMA_SYS_WINDOWS
\r
36 #include <Windows.h>
\r
45 ////////////////////////////////////////////////////////////
\r
46 /// \brief Manages a Dynamic Linking Library.
\r
48 ////////////////////////////////////////////////////////////
\r
54 ////////////////////////////////////////////////////////////
\r
55 /// \brief Load a library.
\r
57 /// \param path Path to the library.
\r
59 /// \return Pointer to the loaded library, or NULL if failed.
\r
61 ////////////////////////////////////////////////////////////
\r
62 static DLibrary* load(const std::string& path);
\r
64 ////////////////////////////////////////////////////////////
\r
65 /// \brief Destructor.
\r
67 /// Close and free the opened library (if any).
\r
69 ////////////////////////////////////////////////////////////
\r
72 ////////////////////////////////////////////////////////////
\r
73 /// \brief Get a symbol from the library.
\r
75 /// \param symbol Symbol that we're looking for.
\r
77 /// \return Pointer to what the symbol refers to, or NULL if
\r
78 /// the symbol is not found.
\r
80 ////////////////////////////////////////////////////////////
\r
81 void* getSymbol(const std::string& symbol);
\r
86 ////////////////////////////////////////////////////////////
\r
87 /// \brief Default constructor.
\r
89 /// Library instances cannot be created, use load instead.
\r
93 ////////////////////////////////////////////////////////////
\r
96 ////////////////////////////////////////////////////////////
\r
97 /// \brief Constructor via library handle.
\r
99 /// Used on load function.
\r
103 ////////////////////////////////////////////////////////////
\r
104 DLibrary(void* handle);
\r
108 ////////////////////////////////////////////////////////////
\r
110 ////////////////////////////////////////////////////////////
\r
115 void* handle; ///< Library handle.
\r
120 } // namespace pluma
\r
123 #endif // PLUMA_DYNAMIC_LIBRARY_HPP
\r