[Mono-osx] Gendarme on OS X

Hawston LLH hawston at gmail.com
Mon Apr 16 23:52:46 EDT 2007


hi all,

I am trying out Dumbarton, to see whether C# class function can call into
ObjC class method. What I did is make a standard wrapper class
(MonoObjectRepresentaion) around the MonoObject, and register the C# member
function in ObjC, when the C# function is invoked,  in ObjC, the static
function MyClass_MyFunction() will be called with a MonoObject parameter
which the C# function belongs to. What I need is to retrieve the ObjC
MyClass object which contains the MonoObject itself, and send the
-(void)myFunction: method to it.

Symbolically, it basically mean calling from C# object into ObjC wrapper
object:
    MyClass::MyFunction (in C#)   call into    [MyClass myFunction] (in
ObjC)

how to do this?


In C#:
namespace ABC
{
    public class MyClass
    {
          [MethodImplAttribute(MethodImplOptions.InternalCall)]
          extern public bool MyFunction();

    }
}

In ObjC:

static void MyClass_MyFunction(MonoObject* thisObject)
{
        //??? my problem here is how to use thisObject to retrieve the
MonoObjectRepresentation object which contains it and make a call into the
object's method -(void)myFunction: ????
}

@interface MyClass: DBMonoObjectRepresentation
{
  -(void)myFunction;
}

@implementation MyClass
{
+ (MonoClass*)monoClass
    {
         MonoClass* monoClass = [DBMonoEnvironment monoClassWithName:"
ABC.MyClass" fromAssembly:[MainController myClassAssembly]];
          return monoClass;
    }

-(id) init
    {
         DBMonoEnvironment *monoEnvironment = [DBMonoEnvironment
defaultEnvironment];
         [monoEnvironment registerInternalCall:"ABC.MyClass::MyFunction()"
callPointer:MyClass_MyFunction];
         return self;
   }

-(void) myFunction
   {
            //do something

   }


}


On 4/16/07, Punk Programmer <punkpro at gmail.com> wrote:
>
> Hello,
>
> I am trying to compile and install Gendarme on OS X. Unfortunately, I'm
> very much a beginner (my background is on Windows). My problem is that
> compilation of Gendarme halts with the error message "./configure: line
> 1989: syntax error near unexpected token `MONO_CECIL,'". (What, in general,
> causes this kind of problem?)
>
> I have received some kind assistance by posting the same question on the
> regular mono-list, but I still have the same problem, and am stumped about
> what to do next... I apologize for double posting this way, but I am hoping
> that some kind OS X soul might be able help me through.
>
> Facts: I've installed Mono 1.2.3 from the universal binary download on my
> iBook running Tiger, to /Library/Frameworks. I've downloaded the source
> code for cecil and Gendarme, and with the assistance I got previously, it
> appears that I've successfully compiled and installed cecil.
>
> Any suggestions would be greatly appreciated.
>
> Kind regards,
> Einar
>
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20070417/a30751a4/attachment.html 


More information about the Mono-osx mailing list