2002-03-28 Dietmar Maurer <dietmar@ximian.com>
[mono.git] / mcs / class / corlib / System.Runtime.Remoting / RemotingServices.cs
1 //
2 // System.Runtime.Remoting.RemotingServices.cs
3 //
4 // Authors:
5 //   Dietmar Maurer (dietmar@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System;
11 using System.Reflection;
12 using System.Runtime.Remoting.Messaging;
13 using System.Runtime.CompilerServices;
14
15 namespace System.Runtime.Remoting
16 {
17         public sealed class RemotingServices {
18
19                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
20                 internal extern static object InternalExecute (MonoMethod method, Object obj,
21                                                                Object[] parameters, out object [] out_args);
22
23                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
24                 internal extern static bool IsTransparentProxy (object proxy);
25                 
26                 public static IMethodReturnMessage ExecuteMessage (
27                         MarshalByRefObject target, IMethodCallMessage reqMsg)
28                 {
29                         ReturnMessage result;
30                         
31                         MonoMethod method = (MonoMethod)reqMsg.MethodBase;
32
33                         try {
34                                 object [] out_args;
35                                 object rval = InternalExecute (method, target, reqMsg.Args, out out_args);
36                                 result = new ReturnMessage (rval, out_args, out_args.Length,
37                                                             reqMsg.LogicalCallContext, reqMsg);
38                         
39                         } catch (Exception e) {
40                                 result = new ReturnMessage (e, reqMsg);
41                         }
42
43                         return result;
44                 }
45                                                                    
46                 
47         }
48 }