[Mono-devel-list] Question: Adding Class to corlib

Rafael Teixeira monoman at gmail.com
Mon Jan 24 11:49:28 EST 2005


Hi Christoph

First of All: You should not add your class to the System namespace.
This is a reserved namespace for things that come from ECMA (and as
needed MS). Please choose a different one, even if you are just making
a private build for your experiment, to avoid collision with future
additions to the namespace from rightfull owners.

Second from your description, you recompiled the compiler but not the
corlib. I you fif try to recompile the corlib, it is possible that it
may have no be installed correctly in all places (normally you'll have
3 or 4 mscorlib.dll, depending on if you're compiling profiles 1.0 and
2.0)

I think corlib is a bad place to put your Aspect-Oriented experiment.
Please create a specific library for that. I suggest something like:

assembly name: Commons.Aspects.dll 
namespace name: Commons.Aspects

so your compiling line would turn into something like:

mcs -r:Commons.Aspects Simple.cs

and Simple.cs would be:

         using System;
         using Commons.Aspects;
 
         public class Simple {
 
                 public static void Main(string[] args) {
                         AOPEnvironment.AddAspect();
                 } 
         }

Also, you can investigate the AOP experiments alerady started based in
interception using Attributes and ContextBoundObjects.

Hope it helps,

On Mon, 24 Jan 2005 15:30:58 +0100 (MET), Christoph Stiedl
<Shorty.10 at gmx.at> wrote:
> Hi,
> 
> I'd like to add the following class to the corlib:
> 
> --------------------------------------------------
> using System;
> 
> namespace System.AOP {
>         [Serializable]    // check if serializable is necessary
>         public class AOPEnvironment {
> 
>                 public AOPEnvironment() {
> 
>                 }
> 
>                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
>                 extern static void add_aspect ();
> 
>                 public static void AddAspect() {
>                         // add_aspect();
>                 }
> 
>                 public override string ToString() {
>                         string result = "AOPEnvironment";
>                         return result;
>                 }
> 
>                 // no idea what that is (#if false)
> 
>                 //
>                 // These are not on the Framework
>                 //
> #if false
> 
>                 public override bool Equals(Object obj) {
>                         if ((obj == null) || (!(obj is AOPEnvironment))) {
>                                 return false;
>                         }
> 
>                         // check that
> 
>                         //AOPEnvironment rhs = (AOPEnvironment) obj;
> 
>                         //if (FrameCount != rhs.FrameCount) {
>                         //        return false;
>                         //}
> 
>                         //for (int i = 0; i < FrameCount; i++) {
>                         //        if
> (!GetFrame(i).Equals(rhs.GetFrame(i))) {
>                         //                return false;
>                         //        }
>                         //}
> 
>                         return true;
>                 }
> 
>                 public override int GetHashCode() {
>                         // check that
> 
>                         //return FrameCount;
>                         return 5;
>                 }
> #endif
> 
>         }
> }
> 
> -------------------------------------------------
> 
> and use it like this:
> 
> ------------------------------------------------
> 
>         using System;
>         using System.AOP;
> 
>         public class Simple {
> 
>                 public static void Main(string[] args) {
>                         AOPEnvironment.AddAspect();
>                 }
> 
>         }
> ------------------------------------------------
> 
> What is necessary for that? I created the folder System.AOP in
> corlib and added the line
> 
> System.AOP/AOPEnvironment.cs
> 
> in the File colib.dll.sources.
> 
> After compiling and installing the Compiler =
> make and make install in the directory mcs-1.0.2
> i compile my file:
> 
> mcs Simple.cs and get the following error:
> 
> error CS0246: The namespace `System.AOP' can not be found (missing
> assembly reference?)
> 
> What is wrong? Are there more places I have to make changes?
> 
> Thanks for your help
> 
> Christoph
> 
> --
> 10 GB Mailbox, 100 FreeSMS http://www.gmx.net/de/go/topmail
> +++ GMX - die erste Adresse für Mail, Message, More +++
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.



More information about the Mono-devel-list mailing list