C++和C#接口对应关系

文章目录

  • Windows DATA
  • C++和 C#
  • 举例说明
    • 例如我们在C/C++下的结构数据如下:
    • 函数转换
    • 导入
      • [Pure]:
      • [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]:
      • internal static extern IntPtr UCV_Base_Object_GetName(IntPtr self):
  • StructLayout
      • 构造函数参数
        • 1. `LayoutKind.Sequential`
        • 2. `LayoutKind.Explicit`
        • 3. `LayoutKind.Auto`
      • 其他属性
        • 1. `CharSet`
        • 2. `Pack`
        • 3. `Size`
        • 4. `Value`
    • 转换实例
      • c++
      • c#代码
    • 常亮指针、指针数组、结构体
      • c#
      • c#
      • 常用参数
        • 1. `DllName`
        • 2. `CallingConvention`
        • 3. `CharSet`
        • 4. `ExactSpelling`
        • 5. `EntryPoint`
      • 示例代码
      • 注意事项
    • `DllImport
      • 基本概念
      • 语法结构
      • 常用参数
        • 1. `DllName`
        • 2. `CallingConvention`
        • 3. `CharSet`
        • 4. `ExactSpelling`
        • 5. `EntryPoint`
      • 示例代码
      • 注意事项

Windows DATA

Windows DATA Type .NET Data Type
BOOL,BOOLEAN Boolean or Int32
BSTR String
BYTE Byte
CHAR Byte
DOUBLE Byte
DWPRD Byte
FLOAT Byte
HANDLE(and all other handle types,such as HFONT and HMENU) IntPtr,UintPtr or HandleRef
HRESULT Int32 or UInt32
INT Int32
LANGID Int16 or UInt16
LCID Int32 or UInt32
LONG Int32
LPARAM IntPtr,UintPtr or Objec

你可能感兴趣的:(C#技巧总结,c#,c++,开发语言)