I'm trying to add proper error reporting to a legacy C++ Win32 DLL, after not having programmed in C++ for more than a decade.
This has been a forcible reminder of the incredible tedium of working with null terminated strings in C/C++ - not to mention the potential buffer overrun and security problems.
I'm considering using a more advanced string library - maybe MFC CString or the STL library.
Edit
DLL is used by both older versions of our software - written in C++; and newer versions - written in C#.
Compiler is VS2008.
For the first pass, I'm logging to the standard Windows Event Log, because passing error messages back to the DLLs clients will be a big architectural change (current architecture is terrible, with multiple failure modes being collapsed into a single boolean pass/fail return value that is passed all the way back up the call stack. Needless to say, this makes problem diagnoses a nightmare). But I'll want to improve this at some later date.
String Library Questions
Since this is a DLL, is this even a good idea?
Are there any special considerations for DLLs?
Gotchas I should be aware of?
Is one library better than the other for this purpose?
Null String Questions
If I'm stuck with null terminated, which set of string functions should I be using? The MS help docs discourage the use of the old C functions (e.g. strcat, etc). But there seem to be many, many other options available now (e.g. _tcscat, _mbscat, wcscat, etc). Which should I use, and why?