From 0019bfa16557cee2d3be11eb0650f68b5997d5f4 Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Fri, 21 Jul 2023 02:08:02 -0700 Subject: [PATCH] Extra setup from cling.cpp --- include/xeus-cling/xinterpreter.hpp | 1 + src/xinterpreter.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/xeus-cling/xinterpreter.hpp b/include/xeus-cling/xinterpreter.hpp index 2c13eb86..53dd085e 100644 --- a/include/xeus-cling/xinterpreter.hpp +++ b/include/xeus-cling/xinterpreter.hpp @@ -72,6 +72,7 @@ namespace xcpp void restore_output(); void init_extra_includes(); + void init_libs(); void init_preamble(); void init_magic(); diff --git a/src/xinterpreter.cpp b/src/xinterpreter.cpp index e4ebf65c..90548a80 100644 --- a/src/xinterpreter.cpp +++ b/src/xinterpreter.cpp @@ -60,6 +60,7 @@ namespace xcpp { redirect_output(); init_extra_includes(); + init_libs(); init_preamble(); init_magic(); } @@ -434,6 +435,15 @@ namespace xcpp m_interpreter.AddIncludePaths(XEUS_SEARCH_PATH); } + void interpreter::init_libs() + { + const cling::InvocationOptions& Opts = m_interpreter.getOptions(); + for (const std::string& Lib : Opts.LibsToLoad) + { + m_interpreter.loadFile(Lib); + } + } + void interpreter::init_preamble() { preamble_manager.register_preamble("introspection", new xintrospection(m_interpreter));