From 8f515b504acccf9b2461fa4a36014277a7ae4343 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Wed, 16 Oct 2019 07:41:14 +0100 Subject: [PATCH] Wrapped the first instance trying to use dlopen in a posix safety ifdef --- src/source.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/source.cpp b/src/source.cpp index 464a39948..066e3a52c 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -2,7 +2,10 @@ #include // for move #include // for stringstream + +#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) #include // for dlopen +#endif #include #include "xtensor/xadapt.hpp" @@ -277,12 +280,17 @@ void initialize_source() msg << "Sampling from library source " << settings::path_source << "..."; write_message(msg, 6); + #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) // Open the library void* source_library = dlopen(settings::path_source_library.c_str(),RTLD_LAZY); if(!source_library) { std::stringstream msg("Couldnt open source library " + settings::path_source_library); fatal_error(msg); } + #else + std::stringstream msg("This feature has not yet been implemented for non POSIX systems"); + fatal_error(msg); + #endif // load the symbol typedef Particle::Bank (*sample_t)();