I was investigating this debug TRACE feature too since I use Borland's toolchain. A couple things I noted while I was figure this out.
- Make sure
__TRACE
and __WARN
are define before #include <checks.h>
.
You can also remove the #define __TRACE and __WARN from the translation unit and instead pass it to bcc32 using the -D macroname option during compilation.
- _GetDiagGroupDef is unresolved for BDS2006. It seems the compiler toolchain that comes with BDS2006 and later seems to be missing some function and class implementation that checks.h uses -- in particular _GetDiagGroupDef. I get unresolved references from the linker when compiling a test sample that uses checks.h. This doesn't happen when I use BCB 5.5.1 btw. Using grep/findstr it appears checks.cpp is compiled into the runtime library of BCB5.5.1 but it's missing from BDS2006 toolchain. I'm surprised you didn't run into the same problem, perhaps I didn't install some components. I found a copy of checks.cpp from an older borland toolchain here. Compiling and linking that should fix the unresolved errors.
- The tutorial says that the outdbg1.txt is a temporary file and it only shows up in the borland IDE -- for that file to actually exist you must save it. This suggest to me that their TRACE/WARN Macros doesn't actually output a debug file. It's probably outputting the debug info to a stderr stream.
If that's really the case then redirecting the stderr stream to a file should give what you're looking for. Compile your sample program, then run it with something like this:
myprogram.exe 2> outdbg1.txt
All in all, you'll probably want to find alternative tools to aid you in the debugging process. Unfortunately, the TRACE & WARN macros provided here are poorly documented and for later versions of borland/embarcadero's toolchain it doesn't even work properly because the rtl doesn't have the needed functions/classes compiled into it. As such, the following is worth investigating:
- OutputDebugString API. This has the advantage that any monitor program that uses this API can receive debug message strings from your program that's being debugged.
- xUnit Testing Framework. Google Test is worth checking out.
- and of course your standard integrated IDE debugger :P