1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6#include "Utility/BsModule.h"
7
8namespace bs
9{
10 /** @addtogroup General
11 * @{
12 */
13
14 /**
15 * This manager keeps track of all the open dynamic-loading libraries, it manages opening them opens them and can be
16 * used to lookup already already-open libraries.
17 *
18 * @note Not thread safe.
19 */
20 class BS_UTILITY_EXPORT DynLibManager : public Module<DynLibManager>
21 {
22 public:
23 /**
24 * Loads the given file as a dynamic library.
25 *
26 * @param[in] name The name of the library. The extension can be omitted.
27 */
28 DynLib* load(String name);
29
30 /** Unloads the given library. */
31 void unload(DynLib* lib);
32
33 protected:
34 Set<UPtr<DynLib>, std::less<>> mLoadedLibraries;
35 };
36
37 /** Easy way of accessing DynLibManager. */
38 BS_UTILITY_EXPORT DynLibManager& gDynLibManager();
39
40 /** @} */
41}
42