预处理器时获取库名

预处理器时获取库名

本文介绍了如何在编译/预处理器时获取库名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有办法在编译/预处理器时间获取库名?


假设编译单元myfile.c是一部分mylib.a,来自编译/预处理器时的
myfile.c代码,我想知道

库名是mylib。我找不到等价的

__FUNCTION __,__ FILE__定义获取库名。还有另外吗?$ / b
谢谢,

巴布




没有办法。考虑一下,你的代码是在*之前编译的*它将
写入库中。编译器不是通灵的,它不知道你要将目标文件放入什么的
库。


john



Hi,
Is there a way to obtain library name at compile/preprocessor time?

Assuming that the compilation unit, myfile.c is part of mylib.a, from
myfile.c code at compile/preprocessor time, I would like to know that
the library name is "mylib". I could not find an equivalent of
__FUNCTION__, __FILE__ defines for getting the library name. Is there
another way?
Thanks,
Babu

解决方案



There is no way. Think about it, your code is compiled *before* it goes
into a library. The compiler is not psychic, it does not know what
library you are going to put the object file into.

john




这篇关于如何在编译/预处理器时获取库名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 19:19