Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, July 12, 2018 7:36 AM | 1 vote
In our projects, we are consuming lots of external C/C++ libraries built in various ways. In the past, we often had problems that they were not built as expected, causing either link errors in consumption or behaving differently than expected. We would like to check this independently from the actual consumption of the libraries in order to "fail fast" if there are any issues.
I would like to know if there is a tool to check the following things in particular, given a static library .lib file:
- Which toolset version was used to build? (Minor toolset version is relevant at least in case of VS2017)
- Does the library contain CodeView debug information? (i.e. was it built with the /Z7 compiler option)
- Was the library built for link-time code generation? (i.e. was it built with the /GL compiler option)
Thanks a lot!
All replies (2)
Thursday, July 12, 2018 5:25 PM
There is no way to infer which toolset was used from the contents of an object generally. For the debug build, the compiler command line is placed in the debug section, but this doesn't happen for release version. But this only happens for the debug build because of the /ZI command line option, switch this to /Zi and this goes away even for the debug build. /ZI is also not compatible with the release mode compiler options.
Then there is the fact that with link time code generation enabled, all information about an object is unavailable beyond machine.
You could verify this with dumpbin if you want.
This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.
Thursday, July 12, 2018 7:45 PM
Check if ‘#pragma detect_mismatch’ can be used for some of your purposes.