[Mono-list] Writing daemons in C#

Paolo Molaro lupus@ximian.com
Wed, 20 Nov 2002 20:29:37 +0100


On 11/20/02 Miguel de Icaza wrote:
> > It's better to make the script generate properties:
> > 
> > 	public static int O_EXCL {
> > 		get {return 0xwhatever;}
> > 	}
> 
> The problem with this is that you need to compile the Mono.Posix
> assembly once for each operating system where it will be used.  It will
> certainly work, but we will have different assemblies.
> 
> If we are going that way, there is no reason for using this, we might as
> well, just use a const:
> 
> 	public const int O_EXCL = 0xwhatever;
> 
> Which the compiler can constant fold, so its even better ;-)

No, this is wrong, it will make the programs compiled against such an
assembly platform-dependent. Using properties does not.

> I still think that the model I proposed is best, as we dont need a
> per-OS assembly to be compiled.

But you need a per-OS shared library and the code will be slower at
runtime. So, the two choices are:

1) per-OS assembly
	* faster
	* smaller
	* easier to deploy
2) OS-indep assembly + OS-dependent shared library
	* slower
	* bigger
	* one more thing to deploy

The choice looks like a no brainer to me:-)

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better