# C# 如何调用动态连接库?

  1. 导入命名空间 using System.Runtime.InteropServices;
  2. 非托管DLL放入执行程序同级目录,比如 Debug 、Release 。
[DllImport("XQOCR.dll", EntryPoint = "XQOCR_IsSupport", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int XQOCR_IsSupport(); [DllImport("XQOCR.dll", EntryPoint = "XQOCR_OPenByDefault", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int XQOCR_OPenByDefault(string docPath);

DllImport 引用路径

DllImport 会在以下目录中寻找依赖:

  1. exe根目录
  2. system32目录
  3. 环境变量目录
上一篇:java类集开发中一对多和多对多的关系的实现


下一篇:HADOOP与ORACLE关联