[Mono-list] AppDomain

Torstensson, Patrik patrik.torstensson@intel.com
Tue, 25 Feb 2003 00:39:15 -0800


Ignore my previous post how to fix the problem. The obj->vtable contains
raw pointers and not methods. I think we should handle the tp case in
the runtime invoke method.. 

(I'm taking out my clown kit an putting it on today, I'm today's clown.
:-)

Cheers,
 Patrik

> -----Original Message-----
> From: Torstensson, Patrik [mailto:patrik.torstensson@intel.com] 
> Sent: Tuesday, February 25, 2003 12:12 AM
> To: Daniel Lopez
> Cc: mono-list@ximian.com
> Subject: RE: [Mono-list] AppDomain
> 
> 
> Hi Danel,
> 
> I'm a bit late into the thread but I will try to give you 
> some hints of
> how to fix this;
> 
>   klass = ((MonoTransparentProxy *)sampleApplicationHost)->klass;
> 
> The TP->klass points to the real class object and we don't change that
> vtable when creating a proxy (the proxies is local to a domain and the
> klass objects are static and not domain specific). This means that the
> call:
> 
>   mono_runtime_invoke (klass->vtable[i], sampleApplicationHost, NULL,
> NULL);
> 
> Just calling the method on the global class object pointing 
> to the local
> implementation instead of calling the remoting wrapper that calls
> managed world and remoting (and is then changed into the other domain
> and called..)
> 
> The easy fix for this is to call the vtable on the object directly
> instead (it contains compiled remote wrappers):
> 
>   mono_runtime_invoke (sampleApplicationHost->vtable[i],
> sampleApplicationHost, NULL, NULL);
> 
> This should (I haven't tested it) call the correct remoting function,
> the vtable slot (should) will be the same as for the class.
> 
> Cheers,
>  Patrik Torstensson
> 
> > -----Original Message-----
> > From: Daniel Lopez [mailto:daniel@rawbyte.com] 
> > Sent: Monday, February 24, 2003 7:02 PM
> > To: mono-list@ximian.com
> > Subject: [Mono-list] AppDomain
> > 
> > 
> > 
> > Hi,
> > 
> > I am looking for the correct way to call a method in a 
> > transparent proxy
> > from the C side of mono. When I create an object in a 
> > different AppDomain
> > and call it from C# everything is fine, but when I do it from 
> > C, it gets
> > executed in the same domain.
> > I attach some sample code to demonstrate what I mean.
> > 
> > In c# the result of compiling and running test.exe:
> > mcs test.cs /r:System.Web
> > mono test.exe
> > 
> > Main AppDomain: test.exe
> > Process request AppDomain: 56ca2e66
> > 
> > And compiling and running test.c
> > mcs test.cs /r:System.Web /target:library
> > cp test.dll /usr/lib  (or somewhere where it will be picked 
> > up from the path)
> > gcc -o test test.c pkg-config --cflags --libs mono -lm
> > ./test
> > 
> > Main Domain: testing
> > Process request AppDomain: testing
> > 
> > 
> > So what is the correct way of invoking the method so it will 
> > be executed in
> > the other domain? I tried every method I could think of 
> with no luck.
> > 
> > Best regards
> > 
> > DAniel
> > 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>