[Mono-list] Class Libraries and Portable.NET

Rhys Weatherley rweather@zip.com.au
Thu, 12 Jul 2001 10:04:54 +1000


Scott Sanders wrote:

> I have gone and taken a look at Portable.net
> (http://www.southern-storm.com.au/portable_net.html), and I have to ask why
> we would not work with this from the class library perspective
> (http://www.southern-storm.com.au/portable_net_lib.html)?  The class library
> is separated from the other components, and headway has already been made on
> many of the System classes.  It is also under the GPL.

Actually, it is under a slightly modified version of the GPL, as explained
on the pnetlib Web page.  Those who are debating the pros and cons of
LGPL vs GPL vs something else may want to check my approach out.

Basically, the entire library is under GPL to ensure that all modifications
to the library are re-distributed, but applications are explicitly permitted
to link against the library without becoming infected.  This might sound
like the LGPL, but there is a subtle issue that many people are missing
in this debate.

Any implementation of the C# "corlib" functions need to use a number of
native methods in the form of "internalcall" or "PInvoke" calls.  These
provide functionality that C# itself cannot.  A simple example is the
"GetType" method in "System.Object": it needs to get information from
a location known only to the runtime engine, and so a native method is
needed to collect it.  Microsoft's "mscorlib.dll" has over 1000 of these
native calls.

The licensing issue comes down to this: does the source code to the
native methods need to be made available as part of the library
implementation also?  The library is useless without them.  Let's
say someone contributed the following code:

    extern public int MagicMethod();

Would the LGPL also require them to disclose the source code to
the native implementation of "MagicMethod"?  Maybe not, IMHO.
The result would be a library that only runs on that person's closed
source VM.  But the GPL does force them to disclose how the
native method works.

The upshot is that the GPL (with an explicit linking exception) can
be used to ensure that no third party can contaminate the library by
making it dependent upon a non-free runtime engine.

> Upon a cursory
> inspection, it seems that we should be able to use most/all of
> Portable.NET's class libraries.  Is this the case, or am I missing something
> entirely?

It was separated so that other people could use them if they so wished.

> I understand Portable.NET's approach to the CLI might be different than that
> of Mono's.
> So the question is, why are we re-inventing the wheel WRT the class
> libraries? Or are we at the same point and we should converge regarding
> this?

You'll get nothing except thunderous agreement from me on this.
I want there to be 1 C# library for the various open source efforts
to use, not several.  I still fail to see why Mono re-invented all
of the classes that I had already written and released back in April.
Miguel tried to explain it to me privately, but it still seems to be
a big case of "Not Invented Here" on his part.

Cheers,

Rhys.