Our project is using many static libraries to build the application. How can we make sure we are using release version of libraries in release build of application?
We are making mistakes by taking debug library in release application build.
I am looking for an elegant way in which I can write a module in that we can check whether a particular library is release or debug and report it if not matching. Our application is written in C/C++. (Platform MSVC & GCC)
Assuming you want to find out whether or not the library contains debugging symbols, you have ran the right command for it: objdump --syms *. a | grep debug usually produces non-empty output for the objects that do contain debugging symbols.
By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.
If it is debug, it will display all the actual source code call you do. If it is release, it will just display the founded symbol from the symbol table.
Debug Mode: When we are developing the application. Release Mode: When we are going to production mode or deploying the application to the server. Debug Mode: The debug mode code is not optimized. Release Mode: The release mode code is optimized.
Yes. You can check the Characteristics
field of the IMAGE_FILE_HEADER
structure of the file. If the library is a release build, then bit 0x0200 (DEBUG_STRIPPED
) will be set; on a debug build, it will be clear.
You can find technical information on the PE Format used by Windows EXEs and DLLs, to see how to retrieve that structure, in various places on the 'net (such as here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With