如何从已经使用:: dlopen打开的库中获取在linux中动态加载库的名称? [英] How to get name of dynamically loaded library in linux from within the library that has been opened using ::dlopen?

查看:482
本文介绍了如何从已经使用:: dlopen打开的库中获取在linux中动态加载库的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows中可以使用GetModuleFileName。关于linux?

in windows one can use GetModuleFileName. what about linux?

推荐答案

dladdr()是一个非标准(不是POSIX的一部分)和在OSX。由于它是非标准的,没有保证,但它应该在那里,因为你指定Linux。

dladdr() is a non-standard (not part of POSIX) function that works on most Linux boxes and in OSX. Since it is non standard there are no guarantees, but it should be there since you specified Linux.

这篇关于如何从已经使用:: dlopen打开的库中获取在linux中动态加载库的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆