18 #ifndef INCLUDE_RCF_DYNAMICLIB_HPP 19 #define INCLUDE_RCF_DYNAMICLIB_HPP 24 #include <RCF/Config.hpp> 25 #include <RCF/Exception.hpp> 36 typedef std::shared_ptr<DynamicLib> DynamicLibPtr;
41 DynamicLib(
const std::string & dllName);
42 virtual ~DynamicLib();
52 template<
typename Pfn>
53 void loadDllFunction(Pfn & pfn,
const std::string & funcName,
bool ignoreMisingFunc =
false)
56 pfn = (Pfn) GetProcAddress(mhDll, funcName.c_str());
57 if ( pfn == NULL && !ignoreMisingFunc )
59 DWORD dwErr = GetLastError();
60 Exception e(RcfError_DllFuncLoad, mDllName, funcName, osError(dwErr));
73 template<
typename Pfn>
74 void loadDllFunction(Pfn & pfn,
const std::string & funcName,
bool ignoreMisingFunc =
false)
79 const char * szErr = dlerror();
80 RCF_UNUSED_VARIABLE(szErr);
82 pfn = (Pfn) dlsym(mhDll, funcName.c_str());
83 if ( pfn == NULL && !ignoreMisingFunc )
86 const char * szErr = dlerror();
91 Exception e(RcfError_UnixDllFuncLoad, mDllName, funcName, strErr);
104 #define RCF_LOAD_DLL_FUNCTION(funcName) \ 105 mDynamicLibPtr->loadDllFunction<Pfn_##funcName>(pfn_##funcName, #funcName); 107 #define RCF_LOAD_LIB_FUNCTION(funcName) \ 108 pfn_##funcName = & funcName; 112 #endif // ! INCLUDE_RCF_DYNAMICLIB_HPP Definition: AmiIoHandler.hpp:23