| 63 | }; |
| 64 | |
| 65 | template <typename F> std::function<F> GetFunction(const std::string func_name) |
| 66 | { |
| 67 | auto it = func_map.find(func_name); |
| 68 | if(it == func_map.end()) |
| 69 | { |
| 70 | auto f = dlsym(sl, func_name.c_str()); |
| 71 | if(!f) |
| 72 | { |
| 73 | throw te_error_shared_function_not_found(func_name); |
| 74 | // return nullptr; |
| 75 | } |
| 76 | func_map.emplace(func_name, ( func* )f); |
| 77 | it = func_map.find(func_name); |
| 78 | } |
| 79 | return std::function<F>(( F* )(it->second)); |
| 80 | } |
| 81 | |
| 82 | template <typename F, typename... Args> |
| 83 | typename std::result_of<std::function<F>(Args...)>::type ExecuteFunc(const std::string& func_name, Args&&... args) |
nothing calls this directly
no test coverage detected