dll中的完整文件路径 [英] Full file path in dll
本文介绍了dll中的完整文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个编译成dll的c ++程序。
当我在文本编辑器中打开dll我注意到在dll的某些部分我实际上可以看到源文件的完整路径,即c:\ myproject \ myfile.h
我注意到当我在代码中使用宏__FILE__并且使用第三方项目(例如boost或opencv)时会发生这种情况
有没有办法我可以阻止将完整的文件路径写入dll吗?
谢谢,
Ron
解决方案
当您使用预定义的宏(如__FILE__)时,编译器(在预处理阶段)将宏的评估值放入创建的二进制文件中。对于__FILE__,该值是预处理器加载的文件的完整路径...
如果你不想看到它不使用它或者仅在调试模式下使用它并在编译发布时隐藏(使用#define和#ifdef)...
你必须在发布模式下构建dll。检查项目中的编译器设置。
在发布版本中,这些宏不应该在二进制输出中编译。
也许你应该看看发布dll的构建方式。 :-O
Hi,
I have a c++ program that compiles to a dll.
When i open the dll in a text editor i noticed that in some part of the dll i can actually see a full path to the source files i.e c:\myproject\myfile.h
I have noticed that this happens when i use macro in my code with __FILE__ and when using 3rdparty projects such as boost or opencv
Is there any way that i can prevent the full file path to be written to the dll?
Thanks,
Ron
解决方案
When you are using predefined macros like __FILE__ the compiler (at the pre-processing stage) puts the evaluated value of the macro in the binary created. For __FILE__ that value is the full path to the file as loaded by the pre-processor...
If you do not want to see it don't use it or use it only in debug mode and hide (with #define and #ifdef) when compiling for release...
you must build the dll in release mode. Check the compiler settings in your project.
In a release build these macro should not get compiled in the binary output.
Maybe you should look WHERE the release dll is build. :-O
这篇关于dll中的完整文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文