MyGUI: MyGUI_DynLib.h Source File

MyGUI 3.4.3

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
16struct HINSTANCE__;
17typedef 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
25namespace MyGUI
26{
27
34 class MYGUI_EXPORT DynLib
35 {
36 friend class DynLibManager;
37
38 protected:
39 DynLib(std::string_view name);
40
41 public:
44 bool load();
45
48 void unload();
49
51 const std::string& getName() const;
52
61 void* getSymbol(const char* strName) const noexcept;
62
63 protected:
65 std::string dynlibError() const;
66
67 protected:
69 std::string mName;
70
72 MYGUI_DYNLIB_HANDLE mInstance;
73 };
74
75} // namespace MyGUI
76
77#endif // MYGUI_DYNLIB_H_
MYGUI_DYNLIB_HANDLE
#define MYGUI_DYNLIB_HANDLE
Definition MyGUI_DynLib.h:19
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI::DynLib::getSymbol
void * getSymbol(const char *strName) const noexcept
Definition MyGUI_DynLib.cpp:85
MyGUI::DynLib::DynLib
DynLib(std::string_view name)
Definition MyGUI_DynLib.cpp:30
MyGUI::DynLib::DynLibManager
friend class DynLibManager
Definition MyGUI_DynLib.h:36
MyGUI::DynLib::getName
const std::string & getName() const
Get the name of the library.
Definition MyGUI_DynLib.cpp:124
MyGUI::DynLib::mName
std::string mName
Name of library.
Definition MyGUI_DynLib.h:69
MyGUI::DynLib::dynlibError
std::string dynlibError() const
Gets the last loading error.
Definition MyGUI_DynLib.cpp:99
MyGUI::DynLib::unload
void unload()
Definition MyGUI_DynLib.cpp:67
MyGUI::DynLib::mInstance
void * mInstance
Handle to the loaded library.
Definition MyGUI_DynLib.h:72
MyGUI::DynLib::load
bool load()
Definition MyGUI_DynLib.cpp:36
MyGUI
Definition MyGUI_ActionController.h:15