diff options
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 |