1 #ifndef _NNDEPLOY_BASE_DLOPEN_H_
2 #define _NNDEPLOY_BASE_DLOPEN_H_
18 #include <libloaderapi.h>
26 #define NNDEPLOY_DEFINE_FUNC_PTR(func) func##Func func = nullptr
29 #define NNDEPLOY_LOAD_FUNCTION_PTR(handle, func_name) \
31 reinterpret_cast<func_name##Func>(GetProcAddress(handle, #func_name)); \
32 if (func_name == nullptr) { \
33 NNDEPLOY_LOGE("load func (%s) from (%s) failed!\n", #func_name, \
34 library_path.c_str()); \
39 #define NNDEPLOY_TRY_LOAD_FUNCTION_PTR(handle, func_name) \
41 reinterpret_cast<func_name##Func>(GetProcAddress(handle, #func_name)); \
42 if (func_name == nullptr) { \
43 NNDEPLOY_LOGE("load func (%s) from (%s) failed!\n", #func_name, \
44 library_path.c_str()); \
49 #define NNDEPLOY_LOAD_FUNCTION_PTR(handle, func_name) \
52 reinterpret_cast<func_name##Func>(loadOpenCLPointer(#func_name)); \
54 func_name = reinterpret_cast<func_name##Func>(dlsym(handle, #func_name)); \
56 if (func_name == nullptr) { \
57 NNDEPLOY_LOGE("load func (%s) from (%s) failed!\n", #func_name, \
58 library_path.c_str()); \
64 #define NNDEPLOY_TRY_LOAD_FUNCTION_PTR(handle, func_name) \
67 reinterpret_cast<func_name##Func>(loadOpenCLPointer(#func_name)); \
69 func_name = reinterpret_cast<func_name##Func>(dlsym(handle, #func_name)); \
71 if (func_name == nullptr) { \
72 NNDEPLOY_LOGE("load func (%s) from (%s) failed!\n", #func_name, \
73 library_path.c_str()); \
#define NNDEPLOY_CC_API
api
bool loadLibraryFromPath(const std::string &path, bool update)
bool freeLibrary(const std::string &path)
Handle * getLibraryHandle(const std::string &path, bool update)