---
title: llarp/win32/dll.hpp

---

# llarp/win32/dll.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::win32](Namespaces/namespacellarp_1_1win32.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| class | **[llarp::win32::DLL](Classes/classllarp_1_1win32_1_1DLL.md)**  |




## Source code

```cpp
#pragma once
#include <windows.h>
#include "exception.hpp"
#include <llarp/util/str.hpp>

namespace llarp::win32
{
  class DLL
  {
    const HMODULE m_Handle;

   protected:
    template <typename Func_t>
    void
    init(std::string name, Func_t& func)
    {
      auto ptr = GetProcAddress(m_Handle, name.c_str());
      if (not ptr)
        throw win32::error{fmt::format("function '{}' not found", name)};
      func = reinterpret_cast<Func_t&>(ptr);
    }

   public:
    DLL(std::string dll);

    virtual ~DLL();
  };
}  // namespace llarp::win32
```


-------------------------------

Updated on 2022-09-01 at 18:16:54 +0000
