Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我加载了一个 dylib 并丢弃了句柄:
void loadfoo() { dlopen("/lib/foo.dylib" , RTLD_NOW); }
然后我想在另一个函数中关闭它:
void closefoo() { dlclose // ??? }
如果在调用过程中没有保存之前加载的 dylib 的句柄,我能以某种方式找到它dlopen吗?
dlopen
如果我在生产中看到这样的代码,我会永远鄙视其发起者,但是:
void *handle = dlopen("/lib/foo.dylib", RTLD_NOW); dlclose(handle); dlclose(handle);