diff options
author | Stefan Laner <laner@itestra.de> | 2014-02-24 09:41:53 +0100 |
---|---|---|
committer | Stefan Laner <laner@itestra.de> | 2014-02-26 10:52:17 +0100 |
commit | b94ed2030fd13d100a757d531983b2fd2498b62e (patch) | |
tree | cc2c675f7999130edbd4ea76ebd6458d0d730c9b /src/CommonAPI/Runtime.cpp | |
parent | fa209eed0e5c81c277601aa24069fa23f61b675d (diff) | |
download | genivi-common-api-runtime-b94ed2030fd13d100a757d531983b2fd2498b62e.tar.gz |
Windows compatible version
Change-Id: I775e584175ec3dcde258e7bed261c61e763d20ce
Diffstat (limited to 'src/CommonAPI/Runtime.cpp')
-rw-r--r-- | src/CommonAPI/Runtime.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/CommonAPI/Runtime.cpp b/src/CommonAPI/Runtime.cpp index a38556a..812b410 100644 --- a/src/CommonAPI/Runtime.cpp +++ b/src/CommonAPI/Runtime.cpp @@ -6,8 +6,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <sys/types.h> #include <sys/stat.h> +#ifndef WIN32 #include <dirent.h> #include <dlfcn.h> +#endif #include <algorithm> #include <iostream> @@ -28,7 +30,7 @@ static bool isDynamic_ = false; static const char COMMONAPI_LIB_PREFIX[] = "libCommonAPI-"; static const char MIDDLEWARE_INFO_SYMBOL_NAME[] = "middlewareInfo"; - +#ifndef WIN32 inline bool Runtime::tryLoadLibrary(const std::string& libraryPath, void** sharedLibraryHandle, MiddlewareInfo** foundMiddlewareInfo) { @@ -66,7 +68,6 @@ inline bool Runtime::tryLoadLibrary(const std::string& libraryPath, return true; } - bool Runtime::checkAndLoadLibrary(const std::string& libraryPath, const std::string& requestedBindingIdentifier, bool keepLibrary) { @@ -102,7 +103,6 @@ bool Runtime::checkAndLoadLibrary(const std::string& libraryPath, return true; } - bool Runtime::checkAndLoadDefaultLibrary(std::string& foundBindingIdentifier, const std::string& libraryPath) { void* sharedLibraryHandle = NULL; MiddlewareInfo* foundMiddlewareInfo; @@ -122,7 +122,6 @@ bool Runtime::checkAndLoadDefaultLibrary(std::string& foundBindingIdentifier, co return true; } - const std::vector<std::string> Runtime::readDirectory(const std::string& path) { std::vector<std::string> result; struct stat filestat; @@ -167,7 +166,7 @@ const std::vector<std::string> Runtime::readDirectory(const std::string& path) { return result; } - +#endif struct LibraryVersion { int32_t major; @@ -185,7 +184,7 @@ bool operator<(LibraryVersion const& lhs, LibraryVersion const& rhs) { return lhs.major < rhs.major; } - +#ifndef WIN32 std::shared_ptr<Runtime> Runtime::checkDynamicLibraries(const std::string& requestedMiddlewareName, LoadState& loadState) { const std::string& middlewareLibraryPath = Configuration::getInstance().getMiddlewareLibraryPath(requestedMiddlewareName); @@ -294,7 +293,7 @@ std::shared_ptr<Runtime> Runtime::checkDynamicLibraries(LoadState& loadState) { return std::shared_ptr<Runtime>(); } - +#endif void Runtime::registerRuntimeLoader(const std::string& middlewareName, const MiddlewareRuntimeLoadFunction& middlewareRuntimeLoadFunction) { if (!registeredRuntimeLoadFunctions_) { @@ -325,14 +324,23 @@ std::shared_ptr<Runtime> Runtime::load(LoadState& loadState) { if (defaultRuntimeLoader != registeredRuntimeLoadFunctions_->end()) { return (defaultRuntimeLoader->second)(); } + +#ifdef WIN32 + return std::shared_ptr<Runtime>(); +#else return checkDynamicLibraries(defaultBindingIdentifier, loadState); +#endif } else { const auto defaultRuntimeLoader = registeredRuntimeLoadFunctions_->begin(); if (defaultRuntimeLoader != registeredRuntimeLoadFunctions_->end()) { return (defaultRuntimeLoader->second)(); } +#ifdef WIN32 + return std::shared_ptr<Runtime>(); +#else return checkDynamicLibraries(loadState); +#endif } } @@ -356,7 +364,11 @@ std::shared_ptr<Runtime> Runtime::load(const std::string& middlewareIdOrAlias, L return (foundRuntimeLoader->second)(); } +#ifdef WIN32 + return std::shared_ptr<Runtime>(); +#else return checkDynamicLibraries(middlewareName, loadState); +#endif } |