19 #ifndef INCLUDE_RCF_DYNAMICLIB_HPP
20 #define INCLUDE_RCF_DYNAMICLIB_HPP
24 #include <boost/config.hpp>
37 DynamicLib(
const std::string & dllName);
38 virtual ~DynamicLib();
46 template<
typename Pfn>
47 void loadDllFunction(Pfn & pfn,
const std::string & funcName)
50 pfn = (Pfn) GetProcAddress(mhDll, funcName.c_str());
53 DWORD dwErr = GetLastError();
54 Exception e(_RcfError_DllFuncLoad(mDllName, funcName), dwErr);
63 template<
typename Pfn>
64 void loadDllFunction(Pfn & pfn,
const std::string & funcName)
69 const char * szErr = dlerror();
70 RCF_UNUSED_VARIABLE(szErr);
72 pfn = (Pfn) dlsym(mhDll, funcName.c_str());
76 const char * szErr = dlerror();
81 Exception e(_RcfError_UnixDllFuncLoad(mDllName, funcName, strErr));
92 #define RCF_LOAD_DLL_FUNCTION(funcName) \
93 loadDllFunction<Pfn_##funcName>(pfn_##funcName, #funcName);
97 #endif // ! INCLUDE_RCF_DYNAMICLIB_HPP