Linux上的可执行文件如何知道从何处获取数据文件?(How do executables on Linux know where to get data files?)

编程入门 行业动态 更新时间:2024-10-25 00:26:41
Linux上的可执行文件如何知道从何处获取数据文件?(How do executables on Linux know where to get data files?)

Linux上的程序将程序的数据安装到$PREFIX/share/programname ,程序如何知道它在哪里,是否需要编译?

是否适合假设二进制文件位于$PREFIX/bin ,并使用它来确定$PREFIX ?

这只需要在Linux上工作,具体来说,我使用的是C.

Programs on Linux install data for programs into $PREFIX/share/programname, how does the program know where that is, does it need to be compiled in?

Would it be suitable to assume that the binary is in $PREFIX/bin, and use that to determine $PREFIX?

This only needs to work on Linux, and specifically, I am using C.

最满意答案

这完全取决于该计划。 常见的模式是将PREFIX定义为预处理程序指令。 GNU autoconf具有标准名称,允许在配置时覆盖它们。

It depends entirely on the program. A common pattern is to define PREFIX as a preprocessor directive. GNU autoconf has standard names and allows them to be overridden at configure time.

更多推荐

本文发布于:2023-08-04 06:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1412431.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可执行文件   文件   数据   Linux   data

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!