MyGUI_DynLib.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_DYNLIB_H_
#define MYGUI_DYNLIB_H_
#include "MyGUI_Prerequest.h"
#include <string>
#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
#define MYGUI_DYNLIB_HANDLE hInstance
struct HINSTANCE__;
typedef struct HINSTANCE__* hInstance;
#elif MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX
#define MYGUI_DYNLIB_HANDLE void*
#elif MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
#include <CoreFoundation/CFBundle.h>
#define MYGUI_DYNLIB_HANDLE CFBundleRef
#endif
namespace MyGUI
{
class MYGUI_EXPORT DynLib
{
friend class DynLibManager;
protected:
DynLib(std::string_view name);
public:
bool load();
void unload();
const std::string& getName() const;
void* getSymbol(const char* strName) const noexcept;
protected:
std::string dynlibError() const;
protected:
std::string mName;
MYGUI_DYNLIB_HANDLE mInstance;
};
} // namespace MyGUI
#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