コード例 #1
0
ファイル: Program.cs プロジェクト: ARLM-Keller/clr-interop
        private static void GenerateMethod(MethodInfo method)
        {
            NativeSignature native_sig;

            Debug.WriteLine(method.DeclaringType.FullName + "::" + method.Name);

            if (NativeSignature.IsPInvoke(method))
            {
                // this is a P/Invoke method
                native_sig = NativeSignature.FromPInvokeSignature(
                    method,
                    options.TargetPlatformAnsi,
                    options.TargetPlatform64Bit);
            }
            else if (NativeSignature.IsRCWMethod(method))
            {
                // this is an RCW method
                native_sig = NativeSignature.FromComInteropSignature(
                    method,
                    options.TargetPlatformAnsi,
                    options.TargetPlatform64Bit);
            }
            else
            {
                ConsoleErrors.ERROR_MethodIsNotInterop.PrintTo(logPrinter, method.Name, method.DeclaringType.FullName);
                return;
            }

            PrintNativeSignature(native_sig);
        }
コード例 #2
0
ファイル: Reflector.cs プロジェクト: toiiggww/clrinterop
        public NativeSignature GetNativeSignature(Guid id, bool ansiPlatform, bool platform64bit)
        {
            MethodInfo info;

            if (methodMap.TryGetValue(id, out info))
            {
                // requesting signature for a method
                if (NativeSignature.IsPInvoke(info))
                {
                    return(NativeSignature.FromPInvokeSignature(info, ansiPlatform, platform64bit));
                }
                else
                {
                    Debug.Assert(NativeSignature.IsRCWMethod(info));
                    return(NativeSignature.FromComInteropSignature(info, ansiPlatform, platform64bit));
                }
            }
            else
            {
                // requesting signature for a delegate
                Type type = typeMap[id];

                Debug.Assert(typeof(Delegate).IsAssignableFrom(type));
                return(NativeSignature.FromDelegateType(type, ansiPlatform, platform64bit));
            }
        }