================ @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_HOST_WINDOWS_LAZYIMPORT_H +#define LLDB_HOST_WINDOWS_LAZYIMPORT_H + +#include "lldb/Host/windows/windows.h" + +namespace lldb_private { + +template <typename FnPtr> class LazyImport { +public: + constexpr LazyImport(const wchar_t *dll, const char *symbol) + : m_dll(dll), m_symbol(symbol) {} + + /// Returns the resolved function pointer, or nullptr if the DLL or symbol + /// is unavailable on this system. Resolution happens once. + FnPtr get() const { + static FnPtr resolved = Resolve(m_dll, m_symbol); ---------------- charles-zablit wrote:
I did not think of this. The latest patch removes the constexpr. The resolution is now done once, in the constructor. https://github.com/llvm/llvm-project/pull/199983 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
