[Mono-list] Preprocessor #define Standardization

develop develop@wtfo.wtfo-guru.com
Sat, 18 Aug 2001 11:05:10 -0500


Several of the classes I am working on will require platform specific
implementations. I realize that in certain cases we'll have separate *.cs
files for instances where the class implementation is completely or mostly
platform specific and have read and understand the guidelines in place for
that scenario. There are cases however where the platform specific code is
minimal and should and can be handled with conditional compilation
directives.

I haven't seen any guidelines on this issue, and a quick search of the code
has found
only one instance of their usage. I have checked the documentation and the
C# compiler (at least Microsoft's compiler) does support accepting
preprocessor definitions on the command line via the /define directive.

I recommend we standardize on the usage of this directives in the class
library now. And perhaps create a document listing the standard directives
in use in the mono class library.
The three definitions I have found are used in the PathTest.cs file, and
meet my needs currently for base level OS directives, although I can
certainly envision that derivatives will be needed as more subtle distro
specific implementation issues are encountered.

The three in use in PathTest.cs are:

WINDOWS
UNIX
MAC