From a7c34123a66f08c9691b1fa14fc549dfe84bae37 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 3 May 2018 01:44:44 +0300 Subject: [PATCH] Improve dynamic_library --- Utilities/dynamic_library.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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...); }