C++ VS2010 compiles my code to nearly readable code
c++, visual-studio-2010, windows
Solution
Is this a hint that VC tries to include some debug info?
Yes, it acutally means that you're linking your dll's with debug info. You can disable it by setting Linker -> Debugging -> Generate Debug Info to No. Note, however, that this option will not (approximately) affect you dll file, but it will switch generation of pdb file.
There are two types of entities, which names will be explicitly stored in dll file:
- Interface functions
- Polymorphic class names
You cannot get rid of the first. Anyone using dll must know, how an interface function is named.
You can, however, disable the second one. Polymorphic class names are necessary only if RTTI is enabled. That's how you're doing `dynamic_cast` and `typeid`. If you don't need these features, you can disable RTTI by going to C/C++ -> Language -> Enable Run-Time Type Information and set it to No. See Remove C++ class names from binary dll file.
All other entities' names will be stripped off by compiler.
Problem
I tried to "hack" my own application using a decompiler. I could clearly see the function names and many argument names. Therefore I think that I am somehow compiling debug information with my code although it is set to Release. Additionally the compiler tells me things like mylib.lib(vq.obj) : warning LNK4099: PDB "vc100.pdb" was not found with "mylib.lib(vq.obj)" or at "M:\myapp\Release\vc100.pdb"; Object will be linked as if not debug information was available. Is this a hint that VC tries to include some debug info? Additionally, my solution consists of 3 projects resulting in 3 dlls in compiled form. When I "hack" one of the 3 dlls, I can see the function names of the 2 other dlls in it. I don't know why. Can somebody tell me how I can make the dll less debuggable and how to "use" only the dll's function in dll instead of all functions in 1 dll. I hope I could explain it well.