[Mono-list] Troubles with mint

Miguel de Icaza miguel@ximian.com
24 Sep 2001 21:25:05 -0400


> In writing the new PlatformAbstractionLayer (which I think is as
> complete as the old classes and much cleaner) I've come across the
> following bug in mint:

Sean,

   I am not sure that using interfaces is such a great idea to
"abstract" the platform bits.  The reason is very simple, we are not
going to have 3 or 4 platforms compiled in at the same time.

Ie, you wont have things like:

	class UnixFile : IFile {
	}

   What we will have is just a class "MyFile" that will have a
completely different implementation for Unix and another one for
Windows.  You have to implement them in different ways for each
architecture.

So you have:

UnixFile.cs
-----
class MyFile { [DllImport("libc") int fopen (char *name, char *mode) }

WinFile.cs
-----
class MyFile { [DllImport("kernel") int fopen (char *name, char *mode) }

User-of-File.cs:
----
class X { MyFile x;  X () { x = new MyFile ();  x.fopen (...); }

The above is an example only.  But notice that for a "Windows" target
we have to compile and link against WinFile.cs, while for a Unix
target you compile and link against UnixFile.cs