started proxy support
[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                 public static IMethodReturnMessage ExecuteMessage (
24                         MarshalByRefObject target, IMethodCallMessage reqMsg)
25                 {
26                         ReturnMessage result;
27                         
28                         MonoMethod method = (MonoMethod)reqMsg.MethodBase;
29
30                         try {
31                                 object [] out_args;
32                                 object rval = InternalExecute (method, target, reqMsg.Args, out out_args);
33                                 result = new ReturnMessage (rval, out_args, out_args.Length,
34                                                             reqMsg.LogicalCallContext, reqMsg);
35                                 
36                         } catch (Exception e) {
37                                 result = new ReturnMessage (e, reqMsg);
38                         }
39
40                         return result;
41                 }
42                                                                    
43                 
44         }
45 }