diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:04:59 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:04:59 +0200 |
commit | f570e2f2685aa43aa518c2f8578391c1847cddbe (patch) | |
tree | b9376b3a7e807c5e0c4cf3d5615c14034d9675d6 /shared/dllLoader.h | |
parent | 3.2 (diff) | |
download | FreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.tar.gz FreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.tar.bz2 FreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.zip |
3.3
Diffstat (limited to 'shared/dllLoader.h')
-rw-r--r-- | shared/dllLoader.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/shared/dllLoader.h b/shared/dllLoader.h index bf62b542..5b561c5a 100644 --- a/shared/dllLoader.h +++ b/shared/dllLoader.h @@ -5,10 +5,11 @@ namespace Utility { - //load kernel dll functions -template <typename FunctionType> -FunctionType loadDllFunKernel(const std::string& functionName); +//load function from a DLL library, e.g. from kernel32.dll +//NOTE: you're allowed to take a static reference to the return value to optimize performance! :) +template <typename FunctionType> +FunctionType loadDllFunction(const std::wstring& libraryName, const std::string& functionName); @@ -22,13 +23,13 @@ FunctionType loadDllFunKernel(const std::string& functionName); //---------------Inline Implementation--------------------------------------------------- -void* loadSymbolKernel(const std::string& functionName); +void* loadSymbol(const std::wstring& libraryName, const std::string& functionName); template <typename FunctionType> inline -FunctionType loadDllFunKernel(const std::string& functionName) +FunctionType loadDllFunction(const std::wstring& libraryName, const std::string& functionName) { - return reinterpret_cast<FunctionType>(loadSymbolKernel(functionName)); + return reinterpret_cast<FunctionType>(loadSymbol(libraryName, functionName)); } #ifndef FFS_WIN |