library: force typing for symbol queries
This commit is contained in:
parent
1350ea93c7
commit
93ddd4c11d
@ -16,7 +16,6 @@
|
||||
|
||||
#include "library_posix.hpp"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
@ -46,11 +45,3 @@ library_posix::~library_posix ()
|
||||
if (m_handle)
|
||||
dlclose (m_handle);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void*
|
||||
library_posix::symbol (const char *name)
|
||||
{
|
||||
return dlsym (m_handle, name);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include <experimental/filesystem>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace util {
|
||||
namespace detail {
|
||||
class library_posix {
|
||||
@ -30,7 +32,14 @@ namespace util {
|
||||
library_posix (const library_posix&) = delete;
|
||||
library_posix& operator= (const library_posix&) = delete;
|
||||
|
||||
void* symbol (const char *name);
|
||||
template <typename FunctionT>
|
||||
FunctionT
|
||||
symbol (const char *name)
|
||||
{
|
||||
return reinterpret_cast<FunctionT> (
|
||||
dlsym (m_handle, name)
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
void *m_handle;
|
||||
|
Loading…
Reference in New Issue
Block a user