Improve dynamic_library
This commit is contained in:
@@ -63,14 +63,26 @@ namespace utils
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caller
|
void init()
|
||||||
R operator()(Args... args)
|
|
||||||
{
|
{
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
// TODO: atomic
|
// TODO: atomic
|
||||||
ptr = reinterpret_cast<R(*)(Args...)>(get_proc_address(lib, name));
|
ptr = reinterpret_cast<R(*)(Args...)>(get_proc_address(lib, name));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operator bool()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Caller
|
||||||
|
R operator()(Args... args)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
return ptr(args...);
|
return ptr(args...);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user