OpenShot Library | libopenshot-audio
0.2.0
juce_DynamicLibrary.h
1
2
/** @weakgroup juce_core-threads
3
* @{
4
*/
5
/*
6
==============================================================================
7
8
This file is part of the JUCE library.
9
Copyright (c) 2017 - ROLI Ltd.
10
11
JUCE is an open source library subject to commercial or open-source
12
licensing.
13
14
The code included in this file is provided under the terms of the ISC license
15
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16
To use, copy, modify, and/or distribute this software for any purpose with or
17
without fee is hereby granted provided that the above copyright notice and
18
this permission notice appear in all copies.
19
20
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22
DISCLAIMED.
23
24
==============================================================================
25
*/
26
27
namespace
juce
28
{
29
30
/**
31
Handles the opening and closing of DLLs.
32
33
This class can be used to open a DLL and get some function pointers from it.
34
Since the DLL is freed when this object is deleted, it's handy for managing
35
library lifetimes using RAII.
36
37
@tags{Core}
38
*/
39
class
JUCE_API
DynamicLibrary
40
{
41
public
:
42
/** Creates an unopened DynamicLibrary object.
43
Call open() to actually open one.
44
*/
45
DynamicLibrary
() =
default
;
46
47
/**
48
*/
49
DynamicLibrary
(
const
String
& name) { open (name); }
50
51
/** Move constructor */
52
DynamicLibrary
(
DynamicLibrary
&& other) noexcept
53
{
54
std::swap (handle, other.handle);
55
}
56
57
/** Destructor.
58
If a library is currently open, it will be closed when this object is destroyed.
59
*/
60
~DynamicLibrary
() { close(); }
61
62
/** Opens a DLL.
63
The name and the method by which it gets found is of course platform-specific, and
64
may or may not include a path, depending on the OS.
65
If a library is already open when this method is called, it will first close the library
66
before attempting to load the new one.
67
@returns true if the library was successfully found and opened.
68
*/
69
bool
open (
const
String
& name);
70
71
/** Releases the currently-open DLL, or has no effect if none was open. */
72
void
close();
73
74
/** Tries to find a named function in the currently-open DLL, and returns a pointer to it.
75
If no library is open, or if the function isn't found, this will return a null pointer.
76
*/
77
void
* getFunction (
const
String
& functionName) noexcept;
78
79
/** Returns the platform-specific native library handle.
80
You'll need to cast this to whatever is appropriate for the OS that's in use.
81
*/
82
void
*
getNativeHandle
() const noexcept {
return
handle; }
83
84
private
:
85
void
* handle =
nullptr
;
86
87
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
DynamicLibrary
)
88
};
89
90
}
// namespace juce
91
92
/** @}*/
juce::DynamicLibrary::DynamicLibrary
DynamicLibrary(DynamicLibrary &&other) noexcept
Move constructor.
Definition:
juce_DynamicLibrary.h:52
JUCE_API
#define JUCE_API
This macro is added to all JUCE public class declarations.
Definition:
juce_StandardHeader.h:143
juce::DynamicLibrary::getNativeHandle
void * getNativeHandle() const noexcept
Returns the platform-specific native library handle.
Definition:
juce_DynamicLibrary.h:82
juce::String
The JUCE String class!
Definition:
juce_String.h:42
juce::DynamicLibrary::~DynamicLibrary
~DynamicLibrary()
Destructor.
Definition:
juce_DynamicLibrary.h:60
juce::DynamicLibrary
Handles the opening and closing of DLLs.
Definition:
juce_DynamicLibrary.h:39
juce_core
threads
juce_DynamicLibrary.h
Generated on Wed Jun 24 2020 20:19:20 for OpenShot Library | libopenshot-audio by
1.8.17