1 #ifndef LIBFILEZILLA_GLUE_DLL_HEADER
2 #define LIBFILEZILLA_GLUE_DLL_HEADER
4 #include "../libfilezilla.hpp"
8 #include "./windows.hpp"
17 class FZ_PUBLIC_SYMBOL
dll final
25 explicit dll(
wchar_t const* name, DWORD flags)
26 : h_{LoadLibraryExW(name,
nullptr, flags)}
37 static dll from_address(T
const& t) {
39 if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<char const*>(t), &d.h_)) {
45 dll(dll
const&) =
delete;
46 dll& operator=(dll
const&) =
delete;
49 dll& operator=(dll && d);
51 explicit operator bool()
const {
61 return h_ ?
reinterpret_cast<void*
>(::GetProcAddress(h_, name)) :
nullptr;
115 #define FZ_DLL_IMPORT(dll, symbol) \
116 static const auto symbol = reinterpret_cast<decltype(&::symbol)>((dll)[#symbol]) \
120 #error This file is for Windows only
dll(wchar_t const *name, DWORD flags)
Open the specified library with the passed in flags.
Definition: dll.hpp:25
dll ole32_
The Ole32 DLL.
Definition: dll.hpp:85
~dll()
Closes the library and frees related resources.
Definition: dll.hpp:30
void * operator[](char const *name) const
Retrieves the address of an exported symbol in the library.
Definition: dll.hpp:60
A collection of commonly used dlls.
Definition: dll.hpp:72
dll shell32_
The Shell32 DLL.
Definition: dll.hpp:84
The namespace used by libfilezilla.
Definition: apply.hpp:17
Encapsulates a DLL.
Definition: dll.hpp:17