diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:42 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:42 +0200 |
commit | c32707148292d104c66276b43796d6057c8c7a5d (patch) | |
tree | bb83513f4aff24153e21a4ec92e34e4c27651b1f /shared/dll_loader.h | |
parent | 3.9 (diff) | |
download | FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.gz FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.bz2 FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.zip |
3.10
Diffstat (limited to 'shared/dll_loader.h')
-rw-r--r-- | shared/dll_loader.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/shared/dll_loader.h b/shared/dll_loader.h index 86723c68..b3fa5218 100644 --- a/shared/dll_loader.h +++ b/shared/dll_loader.h @@ -8,16 +8,29 @@ #define DLLLOADER_H_INCLUDED #include <string> +#include <wx/msw/wrapwin.h> //includes "windows.h" + namespace util { -//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! :) +/* +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); +FunctionType getDllFun(const std::wstring& libraryName, const std::string& functionName); + +/* +extract binary resources from .exe/.dll: +-- resource.h -- +#define MY_BINARY_RESOURCE 1337 +-- resource.rc -- +MY_BINARY_RESOURCE RCDATA "filename.dat" +*/ +std::string getResourceStream(const std::wstring& libraryName, size_t resourceId); @@ -29,19 +42,14 @@ FunctionType loadDllFunction(const std::wstring& libraryName, const std::string& //---------------Inline Implementation--------------------------------------------------- -void* loadSymbol(const std::wstring& libraryName, const std::string& functionName); +FARPROC loadSymbol(const std::wstring& libraryName, const std::string& functionName); template <typename FunctionType> inline -FunctionType loadDllFunction(const std::wstring& libraryName, const std::string& functionName) +FunctionType getDllFun(const std::wstring& libraryName, const std::string& functionName) { return reinterpret_cast<FunctionType>(loadSymbol(libraryName, functionName)); } - -#ifndef FFS_WIN -use in windows build only! -#endif - } #endif // DLLLOADER_H_INCLUDED |