请问捕捉到异常后怎么处理,能使这个dll重新载入使函数能再次使用
No, you can't.
No, you can't.
解决方案 »
- c# DNS缓存结合爬虫,如何开发???解析完,得到IP怎么用?
- sql语句转linq语句,帮帮忙!
- 新手问题:使用C#将2000/01/01到2011/12/31导入数据库
- 如何在WIn Form中实现多个文件的上传,下载?
- 谁有在WinForm上进行SVG开发的经验?
- TreeView 的问题 ,急!
- winform中dataGrid选中行的问题?
- 如何实现这个效果:当listview显示不下出现...时,如何让鼠标移过去就显示全部内容(好像是在tooltip中显示)?
- JS脚本小问题,,
- 更新Sql Server数据库问题?
- 验证码的代码
- DataList中怎么把一行记录前加上一个标号?
有没有释放的函数呢?应该有的吧,我调用汉王的ocr都有函数释放的
本身dll已经死了,释放也没有用了我就是想找到一种能类似程序关闭又打开的方法
If you have to, try creating an AppDomain and then run the P/Invoke within that domain.
You have to unload the whole domain to free loaded dlls.
i've search the way in internet for long time, i'm still confusing, thanks.
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("出错了!");
}
}
上述的尝试并不能成功 - 刚才的试验表明本地dll并没有随着AppDomain卸载而卸载。
我也不建议显式用LoadLibrary,GetProcAddress和FreeLibrary。回过头来,你的问题在Dll方面,掩盖问题会使以后的开发和维护变得更难。
要在项目开始时选择好的第三方模块,而不要在开发和维护过程中不断擦别人的屁股。