DllImport引入的函数经常异常,怎么能使DLL卸载后重新引入这个函数继续运行呢?
我引入一个DLL后,需要循环调用它的一个函数 这个函数很不稳定,经常抛出异常,再次调用这个就会死机,必须关闭程序才正常
请问捕捉到异常后怎么处理,能使这个dll重新载入使函数能再次使用
[DllImport("AdvOcr.dll", EntryPoint = "OCR_C", SetLastError = true,
CharSet = CharSet.Ansi, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
protected static extern string OCR_C(string type, string fileName);
while(true){
try {
string result = OCR_C(OCR_type, filePath);
}
catch {
MessageBox.Show("出错了!");
}
}