7#ifndef _NIM_SDK_CPP_NIM_SDK_UTIL_H_
8#define _NIM_SDK_CPP_NIM_SDK_UTIL_H_
44 bool LoadSdkDll(
const char* cur_module_dir,
const char* sdk_dll_file_name);
54 void* function_ptr =
nullptr;
55 auto it = function_map.find(function_name);
56 if (it != function_map.end()) {
57 function_ptr = it->second;
59 function_ptr = get_proc_address_wrapper_ ==
nullptr ? nullptr : get_proc_address_wrapper_(function_name.c_str());
61 function_map[function_name] = function_ptr;
69 HINSTANCE instance_nim_;
74 std::map<std::string, void*> function_map;
75 std::function<
void*(
const std::string&)> get_proc_address_wrapper_;
78static void nim_print_unfound_func_name(
char* name) {
79 printf(
"function [ %s ] not found \n", name);
82static void unfound_function_holder() {}
86#define NIM_SDK_GET_FUNC_FROM_INSTANCE(instance, function_ptr) \
87 (instance != nullptr && (((function_ptr)instance->GetFunction(#function_ptr)) != nullptr) \
88 ? ((function_ptr)instance->GetFunction(#function_ptr)) \
89 : (nim::nim_print_unfound_func_name(#function_ptr), (function_ptr)nim::unfound_function_holder))
SDK库辅助类,提供加载/卸载SDK库以及获取接口的方法
Definition: nim_sdk_util.h:38
void * GetFunction(const std::string &function_name)
Definition: nim_sdk_util.h:53
void UnLoadSdkDll()
Definition: nim_sdk_util.cpp:61
void OnSDKInited()
Definition: nim_sdk_util.cpp:75
bool LoadSdkDll(const char *cur_module_dir, const char *sdk_dll_file_name)
Definition: nim_sdk_util.cpp:28
BoolStatus
Definition: nim_sdk_util.h:22
@ BS_TRUE
true
Definition: nim_sdk_util.h:28
@ BS_NOT_INIT
未初始化
Definition: nim_sdk_util.h:24
@ BS_FALSE
false
Definition: nim_sdk_util.h:26