当前位置: 首页>>代码示例>>C#>>正文


C# CallingConvention类代码示例

本文整理汇总了C#中CallingConvention的典型用法代码示例。如果您正苦于以下问题:C# CallingConvention类的具体用法?C# CallingConvention怎么用?C# CallingConvention使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CallingConvention类属于命名空间,在下文中一共展示了CallingConvention类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToString

		internal static string ToString(CallingConvention flags) {
			var sb = new StringBuilder();

			switch (flags & CallingConvention.Mask) {
			case CallingConvention.Default: sb.Append("Default"); break;
			case CallingConvention.C: sb.Append("C"); break;
			case CallingConvention.StdCall: sb.Append("StdCall"); break;
			case CallingConvention.ThisCall: sb.Append("ThisCall"); break;
			case CallingConvention.FastCall: sb.Append("FastCall"); break;
			case CallingConvention.VarArg: sb.Append("VarArg"); break;
			case CallingConvention.Field: sb.Append("Field"); break;
			case CallingConvention.LocalSig: sb.Append("LocalSig"); break;
			case CallingConvention.Property: sb.Append("Property"); break;
			case CallingConvention.Unmanaged: sb.Append("Unmanaged"); break;
			case CallingConvention.GenericInst: sb.Append("GenericInst"); break;
			case CallingConvention.NativeVarArg: sb.Append("NativeVarArg"); break;
			default: sb.Append(string.Format("CC_UNKNOWN_0x{0:X}", (int)(flags & CallingConvention.Mask))); break;
			}

			if ((flags & CallingConvention.Generic) != 0)
				sb.Append(" | Generic");

			if ((flags & CallingConvention.HasThis) != 0)
				sb.Append(" | HasThis");

			if ((flags & CallingConvention.ExplicitThis) != 0)
				sb.Append(" | ExplicitThis");

			if ((flags & CallingConvention.ReservedByCLR) != 0)
				sb.Append(" | ReservedByCLR");

			return sb.ToString();
		}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:33,代码来源:CallingConvention.cs

示例2: JitAction

 public JitAction(
     CallingConvention callingConvention = CallingConvention.Default,
     FunctionHints hints = FunctionHints.None,
     CodeGenerator codeGenerator = null)
     : base(callingConvention, hints, codeGenerator)
 {
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:7,代码来源:JitAction.cs

示例3: UnmanagedCalliDescriptor

 internal UnmanagedCalliDescriptor(CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes)
     : base()
 {
     this.Value = string.Format(CultureInfo.CurrentCulture, "unmanaged {0} {1}({2})",
         unmanagedCallConv.ToString().ToLower(CultureInfo.CurrentCulture),
         new TypeDescriptor(returnType).Value,
         string.Join(", ", CalliDescriptor.GetArguments(parameterTypes).ToArray()));
 }
开发者ID:JasonBock,项目名称:EmitDebugging,代码行数:8,代码来源:UnmanagedCalliDescriptor.cs

示例4: __StandAloneMethodSig

		internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
		{
			this.unmanaged = unmanaged;
			this.unmanagedCallingConvention = unmanagedCallingConvention;
			this.callingConvention = callingConvention;
			this.returnType = returnType;
			this.parameterTypes = parameterTypes;
			this.optionalParameterTypes = optionalParameterTypes;
		}
开发者ID:koush,项目名称:mono,代码行数:9,代码来源:StandAloneMethodSig.cs

示例5: SignatureHelper

	private SignatureHelper(Module mod, IntPtr context, IntPtr sig)
			{
				this.mod = mod;
				this.context = context;
				this.sig = sig;
				this.numArgs = 0;
				this.callConv = (CallingConvention)0;
				this.field = false;
				this.bytesOffset = -1;
				((ModuleBuilder)mod).assembly.AddDetach(this);
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:SignatureHelper.cs

示例6: CompilerFunctionCall

        public CompilerFunctionCall(Compiler compiler, CompilerFunction caller, Operand target, CallingConvention callingConvention, VariableType[] arguments, VariableType returnValue)
            : base(compiler)
        {
            Contract.Requires(arguments != null);

            _caller = caller;
            _target = target;

            _functionPrototype = new FunctionDeclaration(callingConvention, arguments, returnValue);
            if (arguments != null && arguments.Length > 0)
                _args = new Operand[arguments.Length];
        }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:12,代码来源:CompilerFunctionCall.cs

示例7: FunctionDeclaration

        internal FunctionDeclaration(CallingConvention callingConvention, VariableType[] arguments, VariableType returnValue)
        {
            Contract.Requires(arguments != null);

            if (callingConvention == CallingConvention.Default)
                callingConvention = CallingConventionInfo.DefaultCallingConvention;

            _callingConvention = callingConvention;
            if (arguments.Length > 32)
                throw new ArgumentException();

            SetPrototype(arguments, returnValue);
        }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:13,代码来源:FunctionDeclaration.cs

示例8: DynamicDllFunctionInvoke

        public static object DynamicDllFunctionInvoke(
            string dllPath,
            string entryPoint,
            MethodAttributes methodAttr,
            CallingConvention nativeCallConv,
            CharSet nativeCharSet,
            Type returnType,
            Type[] parameterTypes,
            object[] parameterValues
            )
        {
            string dllName = Path.GetFileNameWithoutExtension(dllPath);
            // ����һ����̬����(assembly)��ģ��(module)
            AssemblyName assemblyName = new AssemblyName();
            assemblyName.Name = string.Format("A{0}{1}",
                dllName,
                Guid.NewGuid().ToString( "N" )
                );
            AssemblyBuilder dynamicAssembly =
              AppDomain.CurrentDomain.DefineDynamicAssembly(
              assemblyName, AssemblyBuilderAccess.Run);
            ModuleBuilder dynamicModule =
              dynamicAssembly.DefineDynamicModule(
              string.Format("M{0}{1}",
              dllName,
              Guid.NewGuid().ToString("N"))
              );

            // ʹ��ָ������Ϣ����ƽ̨����ǩ��
            MethodBuilder dynamicMethod =
                dynamicModule.DefinePInvokeMethod(
                entryPoint,
                dllPath,
                methodAttr,
                CallingConventions.Standard,
                returnType,
                parameterTypes,
                nativeCallConv,
                nativeCharSet
                );

            // ��������
            dynamicModule.CreateGlobalFunctions();

            // ���ƽ̨���õķ���
            MethodInfo methodInfo =
                dynamicModule.GetMethod(entryPoint, parameterTypes);
            // ���÷��йܺ�������÷��صĽ��
            object result = methodInfo.Invoke(null, parameterValues);
            return result;
        }
开发者ID:zhaohengyi,项目名称:dotNet_PInvoke,代码行数:51,代码来源:DynamicPInvokeViaEmit.cs

示例9: MethodDesc

        public unsafe MethodDesc(string name, string dll, string entryPoint, FUNCDESC funcdesc, string[] argumentNames, Func<uint, TypeDesc> typeFactory)
        {
            string tmpl = "___overloaded000";
            if ((name.Length > tmpl.Length) && (name.IndexOf("___overloaded") == (name.Length - tmpl.Length)))
                name = name.Substring(0, name.Length - tmpl.Length);

            Name = EscapMethodName(name);
            Dll = dll;
            EntryPoint = entryPoint;

            Offset = funcdesc.oVft;

            ReturnValue = new ParameterDesc(funcdesc.elemdescFunc, string.Empty, typeFactory, 0, false, null);
            List<ParameterDesc> parameters = new List<ParameterDesc>();
            for (int i = 0; i < funcdesc.cParams; i++)
                parameters.Add(new ParameterDesc(funcdesc.lprgelemdescParam[i], (i < argumentNames.Length) ? argumentNames[i] : "__arg" + i, typeFactory, 0, false, null));
            Parameters = parameters.AsReadOnly();

            //if (funcdesc.cParamsOpt != 0)
            //    throw new Exception("Variable number of optional parameters is not supported");
            //if (funcdesc.invkind != INVOKEKIND.INVOKE_FUNC)
            //    throw new Exception("Only functions are currently supported");
            if (funcdesc.cScodes >= 1)
                throw new Exception("Only one return value is supported");

            switch (funcdesc.callconv)
            {
                case System.Runtime.InteropServices.ComTypes.CALLCONV.CC_CDECL:
                    Convention = CallingConvention.Cdecl;
                    break;
                case System.Runtime.InteropServices.ComTypes.CALLCONV.CC_STDCALL:
                    Convention = CallingConvention.StdCall;
                    break;
                default:
                    throw new Exception("Calling convention " + funcdesc.callconv + " is not supported");
            }

            switch (funcdesc.funckind)
            {
                case FUNCKIND.FUNC_DISPATCH:
                case FUNCKIND.FUNC_VIRTUAL:
                case FUNCKIND.FUNC_PUREVIRTUAL:
                case FUNCKIND.FUNC_NONVIRTUAL:
                case FUNCKIND.FUNC_STATIC:
                    break;
                default:
                    throw new Exception("Function kind " + funcdesc.funckind + " is not supported");
            }
        }
开发者ID:tablesmit,项目名称:NRegFreeCom,代码行数:49,代码来源:MethodDesc.cs

示例10: MethodSignature

 public MethodSignature(
     bool hasThis,
     bool explicitThis,
     CallingConvention callingConvention,
     int genericParamCount,
     IReadOnlyList<Parameter> parameters,
     Type retType
     )
 {
     m_hasThis = hasThis;
     m_explicitThis = explicitThis;
     m_callingConvention = callingConvention.CheckDefined("callingConvention");
     m_genericParamCount = genericParamCount.CheckGTE(0, "genericParamCount");
     m_parameters = parameters.CheckNotNull("parameters");
     m_retType = retType.CheckNotNull("retType");
 }
开发者ID:scottwis,项目名称:tiny,代码行数:16,代码来源:MethodSignature.cs

示例11: DLLExportAttribute

        public DLLExportAttribute(string exportName,CallingConvention callingConvention)
        {
            ExportName = exportName;
            switch(callingConvention)
            {
                case CallingConvention.Winapi:
                case CallingConvention.StdCall:
                    Convention	= typeof(CallConvStdcall).FullName;
                    break;
                case CallingConvention.FastCall:
                    Convention	= typeof(CallConvFastcall).FullName;
                    break;
                case CallingConvention.ThisCall:
                    Convention	= typeof(CallConvThiscall).FullName;
                    break;
                case CallingConvention.Cdecl:
                    Convention	= typeof(CallConvCdecl).FullName;
                    break;

                default:
                    throw new NotImplementedException();
            }
        }
开发者ID:Thaina,项目名称:Librarinth-Web-Client,代码行数:23,代码来源:ExportDllAttribute.cs

示例12: Client

 /// <summary>
 /// Only constructor.
 /// </summary>
 /// <param name="ChanKind"></param>
 /// <param name="ObjType"></param>
 /// <param name="CallConv"></param>
 /// <param name="InvKind"></param>
 public Client(ChannelKind ChanKind, 
               Type ObjType, 
               CallingConvention CallConv, 
               InvokeKind InvKind,
               string Host)
 {
   m_ChanKind = ChanKind;
   m_ObjType = ObjType;
   m_CallConv = CallConv;
   m_InvKind = InvKind;
   m_Host = Host;
 }//constructor
开发者ID:ArildF,项目名称:masters,代码行数:19,代码来源:client.cs

示例13: GetOptions

    }//Usage()
    
    /// <summary>
    /// Gets user options.
    /// </summary>
    private static void GetOptions()
    {
 GetChannel:
      Console.Write("\nHttp (h), TCP (t) or both (b) using threads? ");
      string Reply = Console.ReadLine();
      switch (Reply.ToLower())
      {
        case "b":
          m_ChanKind = ChannelKind.Both;
          break;
        case "h":
          m_ChanKind = ChannelKind.Http;
          break;
        case "t":
          m_ChanKind = ChannelKind.TCP;
          break;
        default:
          Console.WriteLine("Invalid option, please try again.");
          goto GetChannel;
      }//switch

GetConvention:
      Console.Write("\nBy ref (r) or by val (v)? ");
      Reply = Console.ReadLine();
      switch (Reply.ToLower())
      {
        case "r":
          m_CallConv = CallingConvention.ByRef;
          break;
        case "v":
          m_CallConv = CallingConvention.ByVal;
          break;
        default:
          Console.WriteLine("Invalid option, please try again.");
          goto GetConvention;
      }//switch

GetInvoke:
      Console.Write("\nSerial (s) or async (a)? ");
      Reply = Console.ReadLine();
      switch (Reply.ToLower())
      {
        case "a":
          m_InvKind = InvokeKind.Async;
          break;
        case "s":
          m_InvKind = InvokeKind.Sequential;
          break;
        default:
          Console.WriteLine("Invalid option, please try again.");
          goto GetInvoke;
    }//switch

      //Setup the correct Type object to pass to the Client object for object creation.
      switch (m_CallConv)
      {
        case CallingConvention.ByRef:
          m_ObjType = Type.GetType("RemotingSamples.HelloServerByRef,remotingshared");
          break;
        case CallingConvention.ByVal:
          m_ObjType = Type.GetType("RemotingSamples.HelloServerByVal,remotingshared");
          break;
        default:
          throw new System.InvalidOperationException("Invalid Calling Convention in Main()");
      }//switch
      Console.WriteLine();
      return;
    }//GetOptions()
开发者ID:ArildF,项目名称:masters,代码行数:73,代码来源:client.cs

示例14: UnmanagedFunctionPointerAttribute

 public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention)
 {
     this.call_conv = callingConvention;
 }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:4,代码来源:Core.cs

示例15: UnmanagedFunctionPointerAttribute

 public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention)
 {
     _callingConvention = callingConvention;
 }
开发者ID:niemyjski,项目名称:corert,代码行数:4,代码来源:UnmanagedFunctionPointerAttribute.cs


注:本文中的CallingConvention类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。