Repository navigation
Expand file tree
/
Copy pathLoadLibrary.h
More file actions
56 lines (45 loc) · 1.73 KB
/
Copy pathLoadLibrary.h
File metadata and controls
56 lines (45 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
This file is part of the Util library.
Copyright (C) 2017 Sascha Brandt <myeti@mail.upb.de>
This library is subject to the terms of the Mozilla Public License, v. 2.0.
You should have received a copy of the MPL along with this library; see the
file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef UTIL_LOADLIBRARY_H_
#define UTIL_LOADLIBRARY_H_
#include "StringIdentifier.h"
#include <string>
namespace Util {
//! @addtogroup util_helper
//! @{
/**
* Function used to dynamically load a library at runtime.
*
* @note This is highly experimental and not intended for use in production code. Use with caution.
*
* @param filename File path to the dynamic library.
* @return StringIdentifier of the filename on success (used as library handle), or empty StringIdentifier on failure.
*/
UTILAPI const StringIdentifier loadLibrary(const std::string& filename);
/**
* Loads a function of a dynamically loaded library at runtime.
*
* @note This is highly experimental and not intended for use in production code. Use with caution.
*
* @param libraryId Library handle received from loadLibrary.
* @param name name of the function.
* @return Function handle or nullptr.
*/
UTILAPI void* loadFunction(const StringIdentifier& libraryId, const std::string& name);
/**
* Function used to unload a dynamically loaded library.
*
* @note This is highly experimental and not intended for use in production code. Use with caution.
* Actually, don't use it at all, because it can cause unforseeable side effects.
*
* @param libraryId Library handle received from loadLibrary.
*/
UTILAPI void unloadLibrary(const StringIdentifier& libraryId);
//! @}
}
#endif /* end of include guard: UTIL_LOADLIBRARY_H_ */