[Mono-list] Re: System.CodeDom.Compiler licensing issues (was
Hmmm...)
Dwivedi , Ajay Kumar
AjayKumar.Dwivedi@dresdner-bank.com
Fri, 24 May 2002 09:26:50 +0100
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C202FC.C04E8260
Content-Type: text/plain
I have been following the discussion and it seems there
is a lot of confusion over here.
> But there is also the parser side of the Compiler that
> System.CodeDom.Compiler/CodeDomProvider.CreateParser
CodeDomProvider itself is an abstract class, so
there is no way you can instantiate it and call CreateParser ().
CreateGenerator(string filename) and CreateGenerator(TextWriter output)
call the abstract CreateGenerator(), thus there is no way you can use
them without implementing CreateGenerator, whereas CreateParser()
returns null. You can test all this with the attached class.
The CodeDom is implemented by the Compiler, in MS.NET
case the Microsoft.CSharp and Microsoft.VisualBasic etc..
A quick search on google results in
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q304655
To summarise the above link, you need to instantiate
Microsoft.CSharp.CSharpCodeProvider class and then call CreateParser
or CreateCompiler.
Now if mono includes a Mono.CSharp assembly which
is a part of Compiler and under GPL there shouldn't be
any problems. One needs to explicitly link the Mono.CSharp
assembly to use the CodeDom. Well he is free to use
any other CodeDom provider if he doesn't want to use GPL.
Happy Hacking,
Ajay
------_=_NextPart_000_01C202FC.C04E8260
Content-Type: application/octet-stream;
name="code.cs"
Content-Disposition: attachment;
filename="code.cs"
using System;
using System.CodeDom.Compiler;
using System.IO;
public class CodeDomProviderImpl : CodeDomProvider
{
public CodeDomProviderImpl()
{
}
public override ICodeCompiler CreateCompiler()
{
Console.WriteLine("CrateCompiler() Called");
return null;
}
public override ICodeGenerator CreateGenerator()
{
Console.WriteLine("CreateGenerator() Called");
return null;
}
public override ICodeGenerator CreateGenerator(string fileName)
{
Console.WriteLine("CreateGenerator(string filename) Called");
return base.CreateGenerator(fileName);
}
public override ICodeGenerator CreateGenerator(TextWriter output)
{
Console.WriteLine("CreateGenerator(TextWriter output) Called");
return base.CreateGenerator(output);
}
public static void Main()
{
CodeDomProviderImpl impl = new CodeDomProviderImpl();
impl.CreateGenerator("C:\\temp\\somefile.txt");
impl.CreateGenerator(new StreamWriter("C:\\temp\\anotherfile.txt"));
ICodeParser parser = impl.CreateParser();
Console.WriteLine(parser==null?"Parser is null":"Parser is of type " + parser.GetType());
}
}
------_=_NextPart_000_01C202FC.C04E8260--