The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Custom DLL error codes and SetLastError()

I've recently had to start making some DLLs to encapsulate functionality for a huge project at work.  These DLLs need to be loaded into various runtimes (Borland C++, Microsoft C++, Microsoft Visual Basic, etc.) so the exported functions are written in C and use SetLastError() to return error codes.  In addition, I'm using the Message Compiler to generate textual descriptions of the errors
that will be embedded in the DLLs.

Now, take a quick look at the MSDN documentation on error codes[0].

Does anybody actually make use of this?  System error codes don't follow this specification (backward compatibility with MS-DOS), and most non-Microsoft DLLs simply set the customer bit and start error numbers at 1 (ie 0x20000001).  These fields might be useful for event logging, but the parameters to the ReportEvent() function[1] clearly override anything in the bit-fields of the event identifier,  although you could use macros to pull out the bit fields to pass as parameters.

Should I bother following this specification?

[0] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/event_identifiers.asp

[1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/reportevent.asp
I.P. Overscsi
Wednesday, July 13, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz