diff --git a/Utilities/dynamic_library.h b/Utilities/dynamic_library.h index 35dd2619d6..579513dec2 100644 --- a/Utilities/dynamic_library.h +++ b/Utilities/dynamic_library.h @@ -63,14 +63,26 @@ namespace utils { } - // Caller - R operator()(Args... args) + void init() { if (!ptr) { // TODO: atomic ptr = reinterpret_cast(get_proc_address(lib, name)); } + } + + operator bool() + { + init(); + + return ptr; + } + + // Caller + R operator()(Args... args) + { + init(); return ptr(args...); }