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. }  
  • 相关阅读:
    对拍
    311随笔
    精彩才刚刚开始
    做不下去了,就开心一下吧。
    情书
    论Sue这个人呐(=@__@=)
    P1113 杂务
    P1546 最短网络 Agri-Net
    P2009 跑步
    P2814 家谱
  • 原文地址:https://www.cnblogs.com/lizi/p/2362663.html
Copyright © 2011-2022 走看看