zoukankan      html  css  js  c++  java
  • 在C#中调用C++的dll的方法


    1. using System;  
    2. using System.Collections.Generic;  
    3. using System.Text;  
    4. using System.Runtime.InteropServices;   //注入dll需要引用的命名空间  
    5.  
    6. namespace TG300  
    7. {  
    8.     public class TG300API  
    9.     {  
    10.         //打开读写器  
    11.         [DllImport("RM300API.dll", EntryPoint = "OpenReader")]   //  在这里注入dll和对应的C++的方法  
    12.         public static extern IntPtr OpenReader([MarshalAs(UnmanagedType.LPWStr)] string arrCom);   //在C#中调用时使用的方法名称,以此参数的定义  
    13.  
    14.         //关闭读写器  
    15.         [DllImport("RM300API.dll", EntryPoint = "CloseReader")]  
    16.         public static extern void CloseReader(IntPtr handle);  
    17.  
    18.          
    19.     }  
    20. }  
  • 相关阅读:
    *Triangle
    Pascal's Triangle II
    Pascal's Triangle
    Merge Sorted Array
    House Robber
    Find Peak Element
    Container With Most Water
    *Next Permutation
    top命令VIRT,RES,SHR,DATA
    Octave简单使用
  • 原文地址:https://www.cnblogs.com/lizi/p/2362663.html
Copyright © 2011-2022 走看看