I'm using a dll that contains unmanaged code for interacting with specific hardware, and I'm trying to use it from C#, but I keep getting an AccessViolationException.
What's causing it, and how can I fix it?
namespace FingerPrint {
    public unsafe partial class Form1 : Form {
        [DllImport("MyDll.dll")]
        public static extern int DoesExist();
        public unsafe Form1() {
            InitializeComponent();
            MessageBox.Show(DoesExist() + "");
        }
    }
}