summaryrefslogtreecommitdiff
path: root/src/CommonAPI/Runtime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CommonAPI/Runtime.cpp')
-rw-r--r--src/CommonAPI/Runtime.cpp26
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
}