OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine/dyn_lib_lookup.cpp

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

#include <eagine/main.hpp>
#include <iostream>
namespace eagine {
auto main(main_ctx& ctx) -> int {
if(string_view lib_path{ctx.args().find("--library").next()}) {
if(shared_executable_module module{lib_path}) {
if(string_view sym_name{ctx.args().find("--symbol").next()}) {
if(module.exports(sym_name)) {
std::cout << "symbol found" << std::endl;
} else {
std::cout << "symbol not found" << std::endl;
}
} else {
ctx.log().error("missing symbol name argument");
}
} else {
ctx.log()
.error("failed to open ${lib}: ${message}")
.arg(EAGINE_ID(lib), lib_path)
.arg(EAGINE_ID(message), module.error_message());
}
} else {
ctx.log().error("missing library path argument");
}
return 0;
}
} // namespace eagine
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
#define EAGINE_ID(NAME)
Macro for constructing instances of eagine::identifier.
Definition: identifier.hpp:353
Common code is placed in this namespace.
Definition: eagine.hpp:21
static auto find(basic_span< T1, P1, S1 > where, basic_span< T2, P2, S2 > what) -> basic_span< T1, P1, S1 >
Finds the position of the last occurrence of what in a span.
Definition: span_algo.hpp:374

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).