Load the engine library. Empty path consults GPR_EON_RELAX_ENGINE. Returns false with a reason in lastMessage() on failure.
28{
31 const char* env = std::getenv("GPR_EON_RELAX_ENGINE");
33 }
35 message_ = "no engine path: pass one or set GPR_EON_RELAX_ENGINE";
36 return false;
37 }
39 if (lib_ != nullptr) {
40 dlclose(lib_);
41 lib_ = nullptr;
42 }
43 run_ = nullptr;
44 step_ = nullptr;
45 reset_ = nullptr;
46 set_epoch_ = nullptr;
47 last_error_ = nullptr;
48 destroy_ = nullptr;
49 create_ = nullptr;
50 lib_ = dlopen(
resolved.c_str(), RTLD_NOW | RTLD_LOCAL);
51 if (lib_ == nullptr) {
52 const char* err = dlerror();
53 message_ = err != nullptr ? err : "dlopen failed";
54 return false;
55 }
57 reinterpret_cast<abi_stamp_fn>(dlsym(lib_, "eon_relax_abi_stamp"));
59 reinterpret_cast<available_fn>(dlsym(lib_, "eon_relax_available"));
60 create_ = reinterpret_cast<create_fn>(dlsym(lib_, "eon_relax_create"));
61 run_ = reinterpret_cast<run_fn>(dlsym(lib_, "eon_relax_run"));
62 step_ = reinterpret_cast<step_fn>(dlsym(lib_, "eon_relax_step"));
63 reset_ = reinterpret_cast<reset_fn>(dlsym(lib_, "eon_relax_reset"));
64 set_epoch_ = reinterpret_cast<set_epoch_fn>(
65 dlsym(lib_, "eon_relax_set_surface_epoch"));
66 last_error_ =
67 reinterpret_cast<last_error_fn>(dlsym(lib_, "eon_relax_last_error"));
68 destroy_ = reinterpret_cast<destroy_fn>(dlsym(lib_, "eon_relax_destroy"));
69 if (
stamp ==
nullptr || available ==
nullptr || create_ ==
nullptr ||
70 run_ == nullptr || step_ == nullptr || reset_ == nullptr ||
71 set_epoch_ == nullptr || last_error_ == nullptr ||
72 destroy_ == nullptr) {
73 message_ = "mandatory eon_relax symbols missing";
74 dlclose(lib_);
75 lib_ = nullptr;
76 run_ = nullptr;
77 return false;
78 }
81 message_ = "eon_relax ABI stamp mismatch";
82 dlclose(lib_);
83 lib_ = nullptr;
84 run_ = nullptr;
85 return false;
86 }
88 message_ = "eon_relax reports unavailable";
89 dlclose(lib_);
90 lib_ = nullptr;
91 run_ = nullptr;
92 return false;
93 }
94 message_.clear();
95 return true;
96}
eon_relax_version_t stamp() const noexcept
#define EON_RELAX_ABI_MAJOR
#define EON_RELAX_ABI_MINOR
bool available() noexcept
bool resolved(Dual value, Dual error, const BridgeResidualOptions &options)