[Mono-list] code stuff

Miguel de Icaza miguel@ximian.com
20 Jul 2001 15:05:58 -0400


> are there any examples of how PInvoke works? i think i'm going to have to use 
> that for the socket api.

You can find a lot of those in the .NET Beta 2 documentation, search
for "Platform Invoke". 

> actually, this leads into another question: what about enum values address 
> families. in some instances (like wsock2) there's no real gaurantee that an 
> AF is going to be the same from system to system (like IrDA). any ideas about 
> how to do a system independant mapping?

This is indeed a good question.  And to make things worse, systems
like Linux do not even have the same constants across operating
systems: the constants depend on the actual port of Linux (this is a
trick used to simplify emulation of other operating systems, like the
constants in Linux/SPARC mimic SunOS; the constants in Linux/ALpha
match the constants in Tru64 and so on).

So in the long run, we have a number of options:

	* The "corlib.dll" would not be able to be cross platform, and
	  that we might end up having this be compiled/distributed for
	  each system.

	* We define our own constants, and we have a per-platform
          "constant mapper" built into the runtime (jit/interpreter).

None of those options are really great though.  Lets keep thinking
about it. 

Miguel.