我正在使用一个包含用于与特定硬件交互的非托管代码的 dll,并且我正在尝试从 C# 中使用它,但我不断收到 AccessViolationException。
是什么原因造成的,我该如何解决?
namespace FingerPrint {
public unsafe partial class Form1 : Form {
[DllImport("MyDll.dll")]
public static extern int DoesExist();
public unsafe Form1() {
InitializeComponent();
MessageBox.Show(DoesExist() + "");
}
}
}