public static void InvokeMethod(IntPtr instanceHandle, IntPtr methodHandle, IntPtr stack, IntPtr typeIDs) { object instance = ((GCHandle)instanceHandle).Target; MethodInfo method = (MethodInfo)((GCHandle)methodHandle).Target; #if DEBUG if ((QDebug.DebugChannel() & QtDebugChannel.QTDB_TRANSPARENT_PROXY) != 0 && (QDebug.DebugChannel() & QtDebugChannel.QTDB_VIRTUAL) != 0) { Console.WriteLine("ENTER InvokeMethod() {0}.{1}", instance, method.Name); } #endif unsafe { StackItem * stackPtr = (StackItem *)stack; ParameterInfo[] parameters = method.GetParameters(); object[] args = new object[parameters.Length]; TypeId * typeIDsPtr = (TypeId *)typeIDs; for (int i = 0; i < args.Length; i++) { args[i] = SmokeMarshallers.BoxFromStackItem(parameters[i].ParameterType, (int)typeIDsPtr[i + 1], stackPtr + i + 1); } object returnValue = method.Invoke(instance, args); * typeIDsPtr = SmokeMarshallers.GetTypeId(returnValue == null ? typeof(object) : returnValue.GetType()); //TODO: should this always be unboxing something? if (method.ReturnType != typeof(void)) { SmokeMarshallers.UnboxToStackItem(returnValue, stackPtr); } } return; }