1// LAF Base Library
2// Copyright (c) 2020-2021 Igara Studio S.A.
3// Copyright (c) 2016 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef BASE_DLL_H_INCLUDED
9#define BASE_DLL_H_INCLUDED
10#pragma once
11
12#include <string>
13
14namespace base {
15
16typedef void* dll;
17typedef void* dll_proc;
18
19dll load_dll(const std::string& filename);
20void unload_dll(dll lib);
21dll_proc get_dll_proc_base(dll lib, const char* procName);
22
23template<typename T>
24inline T get_dll_proc(dll lib, const char* procName) {
25 return reinterpret_cast<T>(get_dll_proc_base(lib, procName));
26}
27
28#if LAF_WINDOWS
29class Version;
30// TODO get_dll_filename() could be implemented on Linux with the
31// non-standard dlinfo() function
32std::string get_dll_filename(dll lib);
33Version get_dll_version(dll lib);
34#endif
35
36} // namespace base
37
38#endif
39