Improve dynamic_library

This commit is contained in:
Nekotekina 2018-05-03 01:44:44 +03:00
parent 18f9781ea8
commit a7c34123a6

View File

@ -63,14 +63,26 @@ namespace utils
{
}
// Caller
R operator()(Args... args)
void init()
{
if (!ptr)
{
// TODO: atomic
ptr = reinterpret_cast<R(*)(Args...)>(get_proc_address(lib, name));
}
}
operator bool()
{
init();
return ptr;
}
// Caller
R operator()(Args... args)
{
init();
return ptr(args...);
}