Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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
Posted
Updated 27-Apr-15 3:29am
v2
Comments
Sergey Alexandrovich Kryukov 27-Apr-15 9:19am    
Normally, should be no trace of source files at all. How can I know how can you put them in?
—SA

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...
 
Share this answer
 
v3
Comments
babbbam 27-Apr-15 9:36am    
Thanks for the answer @KornfeldEliyahuPeter, however as i mentioned, i am using 3rdparty such as boost and opencv and they are outputing the full path to the dll...
Kornfeld Eliyahu Peter 27-Apr-15 10:05am    
It is possible that you are using a statically linked version of the 3rd party and __FILE__ used there so it becomes part of your code...
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
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 27-Apr-15 9:32am    
That's not enough - if you use these macros in code that are part of the release code it still will be there...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900