summaryrefslogtreecommitdiff
path: root/shared/dll_loader.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/dll_loader.h')
-rw-r--r--shared/dll_loader.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/shared/dll_loader.h b/shared/dll_loader.h
new file mode 100644
index 00000000..86723c68
--- /dev/null
+++ b/shared/dll_loader.h
@@ -0,0 +1,47 @@
+// **************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
+// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
+// **************************************************************************
+//
+#ifndef DLLLOADER_H_INCLUDED
+#define DLLLOADER_H_INCLUDED
+
+#include <string>
+
+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! :)
+template <typename FunctionType>
+FunctionType loadDllFunction(const std::wstring& libraryName, const std::string& functionName);
+
+
+
+
+
+
+
+
+
+
+
+
+//---------------Inline Implementation---------------------------------------------------
+void* loadSymbol(const std::wstring& libraryName, const std::string& functionName);
+
+template <typename FunctionType>
+inline
+FunctionType loadDllFunction(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
bgstack15