MCPcopy Create free account
hub / github.com/Tracktion/choc / DynamicLibrary

Class DynamicLibrary

choc/platform/choc_DynamicLibrary.h:31–57  ·  view source on GitHub ↗

============================================================================== A minimal cross-platform loader for .dll/.so files. */

Source from the content-addressed store, hash-verified

29 A minimal cross-platform loader for .dll/.so files.
30*/
31struct DynamicLibrary
32{
33 DynamicLibrary() = default;
34
35 /// Attempts to load a library with the given name or path.
36 DynamicLibrary (std::string_view library);
37
38 DynamicLibrary (const DynamicLibrary&) = delete;
39 DynamicLibrary& operator= (const DynamicLibrary&) = delete;
40 DynamicLibrary (DynamicLibrary&&);
41 DynamicLibrary& operator= (DynamicLibrary&&);
42
43 /// On destruction, this object releases the library that was loaded
44 ~DynamicLibrary();
45
46 /// Returns a pointer to the function with this name, or nullptr if not found.
47 void* findFunction (std::string_view functionName);
48
49 /// Returns true if the library was successfully loaded
50 operator bool() const noexcept { return handle != nullptr; }
51
52 /// Releases any handle that this object is holding
53 void close();
54
55 /// platform-specific handle. Will be nullptr if not loaded
56 void* handle = nullptr;
57};
58
59
60

Callers 4

getUser32FunctionFunction · 0.85
setFileDropCallbackMethod · 0.85
handleFileDropMethod · 0.85
testPlatformFunction · 0.85

Calls

no outgoing calls

Tested by 1

testPlatformFunction · 0.68