3#include "DynamicLibraries.h"
4#include "Exceptions/FileDoesNotExistException.h"
5#include "Exceptions/CantLoadSourceException.h"
14 vector<HMODULE> loadSources(
const vector<string>& pathToSources)
16 vector<HMODULE> result;
18 result.reserve(pathToSources.size());
20 for (
const string& temp : pathToSources)
22 if (temp == json_settings::defaultLoadSourceValue)
25 result.push_back(dlopen(
nullptr, RTLD_LAZY));
27 result.push_back(
nullptr);
33 string pathToSource = makePathToDynamicLibrary(temp);
35 if (filesystem::exists(pathToSource))
37 HMODULE handle =
nullptr;
40 handle = dlopen(pathToSource.data(), RTLD_LAZY);
42 handle = LoadLibraryA(pathToSource.data());
44 result.push_back(handle);
50 Log::error(
"Can't find source {}",
"LogWebFrameworkSources", pathToSource);
53 throw file_manager::exceptions::FileDoesNotExistException(pathToSource);
60 Log::error(
"Can't load source {}",
"LogWebFrameworkSources", pathToSource);
63 throw exceptions::CantLoadSourceException(pathToSource);