MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / unload_lib

Method unload_lib

src/jit/impl/utils.cpp:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 void unload_lib(void* handle) override {
159 if (handle) {
160 struct link_map* lmap;
161 std::string path;
162 bool path_good;
163 if (dlinfo(handle, RTLD_DI_LINKMAP, &lmap)) {
164 path_good = false;
165 path = ssprintf("<RTLD_DI_ORIGIN failed: %s>", dlerror());
166 } else {
167 path_good = true;
168 path = lmap->l_name;
169 }
170 if (dlclose(handle)) {
171 mgb_log_error("failed to close %s: %s", path.c_str(), dlerror());
172 }
173 if (path_good) {
174 auto h1 = dlopen(path.c_str(), RTLD_NOLOAD | RTLD_LOCAL);
175 if (h1) {
176 dlclose(h1);
177 mgb_log_warn("library %s is not totally released", path.c_str());
178 }
179 }
180 }
181 }
182
183 std::string compile_cpp_source_secondary(
184 const char* source, const char* out_name) override {

Callers 1

~FunctionHandleMethod · 0.80

Calls 4

dlinfoFunction · 0.85
dlcloseFunction · 0.85
dlerrorFunction · 0.50
dlopenFunction · 0.50

Tested by

no test coverage detected