MyGUI  3.4.1
MyGUI_DynLib.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef MYGUI_DYNLIB_H_
8 #define MYGUI_DYNLIB_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include <string>
12 
13 
14 #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
15 # define MYGUI_DYNLIB_HANDLE hInstance
16 struct HINSTANCE__;
17 typedef struct HINSTANCE__* hInstance;
18 #elif MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX
19 # define MYGUI_DYNLIB_HANDLE void*
20 #elif MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
21 # include <CoreFoundation/CFBundle.h>
22 # define MYGUI_DYNLIB_HANDLE CFBundleRef
23 #endif
24 
25 namespace MyGUI
26 {
27 
35  {
36  friend class DynLibManager;
37 
38  protected:
39  DynLib(const std::string& name);
40 
41  public:
42 
45  bool load();
46 
49  void unload();
50 
52  std::string getName(void) const;
53 
62  void* getSymbol( const std::string& strName ) const noexcept;
63 
64  protected:
66  std::string dynlibError() const;
67 
68  protected:
70  std::string mName;
71 
74  };
75 
76 } // namespace MyGUI
77 
78 #endif // MYGUI_DYNLIB_H_
#define MYGUI_DYNLIB_HANDLE
Definition: MyGUI_DynLib.h:19
#define MYGUI_EXPORT
Resource holding data about a dynamic library.
Definition: MyGUI_DynLib.h:35
std::string mName
Name of library.
Definition: MyGUI_DynLib.h:70
void * mInstance
Handle to the loaded library.
Definition: MyGUI_DynLib.h:73
Manager of dynamic libraries.