From 72cb9bd940530dbb56ebb68b5fedb14cfe48c05c Mon Sep 17 00:00:00 2001 From: ftk Date: Sun, 5 Mar 2017 21:26:01 +0300 Subject: [PATCH] Compile out module path search code when module support is disabled --- include/chaiscript/language/chaiscript_engine.hpp | 2 +- samples/fun_call_performance.cpp | 2 ++ src/main.cpp | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index 27b4698..16110f0 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -243,7 +243,7 @@ namespace chaiscript m_parser(std::move(parser)), m_engine(*m_parser) { -#if defined(_POSIX_VERSION) && !defined(__CYGWIN__) +#if !defined(CHAISCRIPT_NO_DYNLOAD) && defined(_POSIX_VERSION) && !defined(__CYGWIN__) // If on Unix, add the path of the current executable to the module search path // as windows would do diff --git a/samples/fun_call_performance.cpp b/samples/fun_call_performance.cpp index a519052..b8bda5a 100644 --- a/samples/fun_call_performance.cpp +++ b/samples/fun_call_performance.cpp @@ -68,6 +68,7 @@ std::vector default_search_paths() { std::vector paths; +#ifndef CHAISCRIPT_NO_DYNLOAD #ifdef CHAISCRIPT_WINDOWS // force no unicode CHAR path[4096]; int size = GetModuleFileNameA(0, path, sizeof(path) - 1); @@ -137,6 +138,7 @@ std::vector default_search_paths() paths.push_back(exepath.substr(0, secondtolastslash) + "/lib/chaiscript/"); } #endif +#endif // ifndef CHAISCRIPT_NO_DYNLOAD return paths; } diff --git a/src/main.cpp b/src/main.cpp index 4179a6b..78044e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,6 +71,7 @@ std::vector default_search_paths() { std::vector paths; +#ifndef CHAISCRIPT_NO_DYNLOAD #ifdef CHAISCRIPT_WINDOWS // force no unicode CHAR path[4096]; int size = GetModuleFileNameA(nullptr, path, sizeof(path)-1); @@ -140,6 +141,7 @@ std::vector default_search_paths() paths.push_back(exepath.substr(0, secondtolastslash) + "/lib/chaiscript/"); } #endif +#endif // ifndef CHAISCRIPT_NO_DYNLOAD return paths; }