diff --git a/src/libfunctionality/CMakeLists.txt b/src/libfunctionality/CMakeLists.txt index e75270b..dd72068 100644 --- a/src/libfunctionality/CMakeLists.txt +++ b/src/libfunctionality/CMakeLists.txt @@ -46,21 +46,23 @@ set(API set(SOURCE DynamicLoadConfig.h.in - LoadPlugin.cpp + LoadPluginInternal.h PluginHandle.cpp) -if(LIBFUNC_DL_WIN32) - list(APPEND SOURCE - LibraryHandleWin32.cpp - LibraryHandleWin32.h - LoadPluginWin32.h) -endif() -if(LIBFUNC_DL_LIBDL) - list(APPEND SOURCE - LibraryHandleLibdl.cpp - LibraryHandleLibdl.h - LoadPluginLibdl.h) -endif() + +### Implementations - guarded with ifdefs + +# Win32 +list(APPEND SOURCE + LibraryHandleWin32.cpp + LibraryHandleWin32.h + LoadPluginWin32.cpp) + +# libdl +list(APPEND SOURCE + LibraryHandleLibdl.cpp + LibraryHandleLibdl.h + LoadPluginLibdl.cpp) ### # "Interface" target for plugins to use - they don't need to link, just need the includes. diff --git a/src/libfunctionality/LibraryHandleLibdl.cpp b/src/libfunctionality/LibraryHandleLibdl.cpp index c0b449c..aef0eab 100644 --- a/src/libfunctionality/LibraryHandleLibdl.cpp +++ b/src/libfunctionality/LibraryHandleLibdl.cpp @@ -25,8 +25,9 @@ // limitations under the License. // Internal Includes -#include "LibraryHandleLibdl.h" #include +#ifdef LIBFUNC_DL_LIBDL +#include "LibraryHandleLibdl.h" #include // Library/third-party includes @@ -53,3 +54,5 @@ LibraryHandle RAIILoadLibrary(std::string const &name) { } } // end of namespace libfunc + +#endif // LIBFUNC_DL_LIBDL \ No newline at end of file diff --git a/src/libfunctionality/LibraryHandleLibdl.h b/src/libfunctionality/LibraryHandleLibdl.h index 6b0ab14..5084399 100644 --- a/src/libfunctionality/LibraryHandleLibdl.h +++ b/src/libfunctionality/LibraryHandleLibdl.h @@ -28,6 +28,8 @@ #define INCLUDED_LibraryHandleLibdl_h_GUID_BA547FB8_A564_4B94_F2AD_58BA772462E4 // Internal Includes +#include +#ifdef LIBFUNC_DL_LIBDL #include // Library/third-party includes @@ -40,4 +42,5 @@ namespace libfunc { LibraryHandle RAIILoadLibrary(std::string const &name); } // end of namespace libfunc +#endif // LIBFUNC_DL_LIBDL #endif // INCLUDED_LibraryHandleLibdl_h_GUID_BA547FB8_A564_4B94_F2AD_58BA772462E4 diff --git a/src/libfunctionality/LibraryHandleWin32.cpp b/src/libfunctionality/LibraryHandleWin32.cpp index e2a041a..74e0fa1 100644 --- a/src/libfunctionality/LibraryHandleWin32.cpp +++ b/src/libfunctionality/LibraryHandleWin32.cpp @@ -25,6 +25,8 @@ // limitations under the License. // Internal Includes +#include +#ifdef LIBFUNC_DL_WIN32 #include "LibraryHandleWin32.h" #include @@ -82,3 +84,4 @@ LibraryHandle RAIILoadLibrary(std::string const &name) { } } // end of namespace libfunc +#endif // LIBFUNC_DL_WIN32 \ No newline at end of file diff --git a/src/libfunctionality/LibraryHandleWin32.h b/src/libfunctionality/LibraryHandleWin32.h index e6d126a..0b67038 100644 --- a/src/libfunctionality/LibraryHandleWin32.h +++ b/src/libfunctionality/LibraryHandleWin32.h @@ -28,6 +28,8 @@ #define INCLUDED_LibraryHandleWin32_h_GUID_767832A3_0B91_43A0_B49F_3818CB69C3A7 // Internal Includes +#include +#ifdef LIBFUNC_DL_WIN32 #include // Library/third-party includes @@ -47,5 +49,5 @@ inline HMODULE GetHMODULE(LibraryHandle const &h) { } } // end of namespace libfunc - +#endif // LIBFUNC_DL_WIN32 #endif // INCLUDED_LibraryHandleWin32_h_GUID_767832A3_0B91_43A0_B49F_3818CB69C3A7 diff --git a/src/libfunctionality/LoadPlugin.cpp b/src/libfunctionality/LoadPluginInternal.h similarity index 81% rename from src/libfunctionality/LoadPlugin.cpp rename to src/libfunctionality/LoadPluginInternal.h index 2fa52bc..a18517c 100644 --- a/src/libfunctionality/LoadPlugin.cpp +++ b/src/libfunctionality/LoadPluginInternal.h @@ -1,5 +1,5 @@ /** @file - @brief Implementation + @brief Internal header @date 2014 @@ -24,6 +24,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifndef INCLUDED_LoadPluginInternal_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E +#define INCLUDED_LoadPluginInternal_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E + // Internal Includes #include #include @@ -47,15 +50,4 @@ typedef libfunc_ep_return_t (*entry_point_t)(void *); /// @} } // end of namespace libfunc -// PLATFORM_SPECIFIC CODE -#ifdef LIBFUNC_DL_SUPPORT - -#ifdef LIBFUNC_DL_WIN32 -#include "LoadPluginWin32.h" -#endif - -#ifdef LIBFUNC_DL_LIBDL -#include "LoadPluginLibdl.h" -#endif - -#endif +#endif // INCLUDED_LoadPluginInternal_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E diff --git a/src/libfunctionality/LoadPluginLibdl.h b/src/libfunctionality/LoadPluginLibdl.cpp similarity index 93% rename from src/libfunctionality/LoadPluginLibdl.h rename to src/libfunctionality/LoadPluginLibdl.cpp index c6e2be4..da32dd6 100644 --- a/src/libfunctionality/LoadPluginLibdl.h +++ b/src/libfunctionality/LoadPluginLibdl.cpp @@ -1,5 +1,5 @@ /** @file - @brief Header + @brief Implementation using libdl (linux, etc.) @date 2014 @@ -24,11 +24,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef INCLUDED_LoadPluginLibdl_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E -#define INCLUDED_LoadPluginLibdl_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E - // Internal Includes +#include +#ifdef LIBFUNC_DL_LIBDL #include "LibraryHandleLibdl.h" +#include "LoadPluginInternal.h" // Library/third-party includes // - none @@ -114,4 +114,5 @@ PluginHandle loadPluginByName(std::string const &n, void *opaque) { return PluginHandle(lib); } } // end of namespace libfunc -#endif // INCLUDED_LoadPluginLibdl_h_GUID_AEC00CE9_5EC3_4D93_6BFF_ABB175D5E66E + +#endif // LIBFUNC_DL_LIBDL \ No newline at end of file diff --git a/src/libfunctionality/LoadPluginWin32.h b/src/libfunctionality/LoadPluginWin32.cpp similarity index 88% rename from src/libfunctionality/LoadPluginWin32.h rename to src/libfunctionality/LoadPluginWin32.cpp index 3787c03..3636a9a 100644 --- a/src/libfunctionality/LoadPluginWin32.h +++ b/src/libfunctionality/LoadPluginWin32.cpp @@ -1,5 +1,5 @@ /** @file - @brief Header + @brief Implementation for win32 @date 2014 @@ -24,11 +24,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef INCLUDED_LoadPluginWin32_h_GUID_F3039817_F263_43B5_B117_AD894AAF1A83 -#define INCLUDED_LoadPluginWin32_h_GUID_F3039817_F263_43B5_B117_AD894AAF1A83 - // Internal Includes +#include +#ifdef LIBFUNC_DL_WIN32 #include "LibraryHandleWin32.h" +#include "LoadPluginInternal.h" // Library/third-party includes // - none @@ -76,4 +76,4 @@ PluginHandle loadPluginByName(std::string const &n, void *opaque) { return PluginHandle(lib); } } // end of namespace libfunc -#endif // INCLUDED_LoadPluginWin32_h_GUID_F3039817_F263_43B5_B117_AD894AAF1A83 +#endif // LIBFUNC_DL_WIN32 \ No newline at end of file