Originally posted by: UserCplex
Hi Laci,
Thanks. Just so I understand further, the compilation with -DNDEBUG is so that the debug information is not available in the object files preventing the user from stepping through CPLEX internal code. Had CPLEX been compiled without defining NDEBUG, then the user would be able to step into and see cplex internal code. This, the user cannot control. For instance, I obtain the attached image from within VTune that cplex1280.dll module does not contain debug information. and that enabling debug information is possible by recompiling with /DEBUG flag. That, presumably, would enable the user to step through CPLEX internal code and VTune to be able to show the hotspot within CPLEX function source code.
Regardless and independent of this, the internal CPLEX source code involved here either defines _DEBUG or does not define it (not to be confused with the /DEBUG flag that VTune is referring to above and in the image). That is, two sets of object files will be produced both with -DNDEBUG. In one of them (that which will eventually be used by the user in /MD linking), _DEBUG is not defined. In the other (that which will eventually be used by the user in /MDd linking), there will be a line on top that says #define _DEBUG. Regardless, both of these are compiled with the -DNDEBUG to suppress generation of debug/symbol lookup information.
What the user can control is in terms of linking, the option of whether to use /MDd or /MD. As explained https://msdn.microsoft.com/en-in/library/2kzt1wy3.aspx, /MDd defines _DEBUG (not to be confused with the -DNDEBUG used in the compilation process above) in addition to _MT and _DLL. By then linking to the cplex180.lib in the appropriate folder (stat_mda for /MD option and stat_mdd for /MDd option), the right functions are loaded. Presumably then, the additional definition of _DEBUG in /MDd, leads to a function in the "debug" cplex180.lib whose underlying source code had such as:
#ifdef _DEBUG
//do stuff that only happens in /MDd linking, not in /MD linking
#endif
Am I right in my understanding? I have been spending time online looking at different sources to try and figure out what exactly these symbols achieve:
https://msdn.microsoft.com/en-in/library/2kzt1wy3.aspx
https://stackoverflow.com/questions/2290509/debug-vs-ndebug
and it is still not fully clear in my head.
Thank you.
#CPLEXOptimizers#DecisionOptimization