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.
更多推荐
发布评论