wsk3q

导航

传递FILE*指针到dll里面之后引起异常

传递FILE*指针到dll里面之后引起异常

Expression: _osfile(fh) & FOPEN


 

最终从此文章找到线索,原来在dll之间传递FILE*会产生兼容性问题。
http://stackoverflow.com/questions/5984144/assertion-error-in-crt-calling-osfile-in-vs-2008
 
解决方案有两种:
(1)把exe和dll都用相同的编译器编译,而且都使用MD选项来编译。
(2)另一种方案是,避免传递FILE*,可以选择直接传递文件名。
 
 
 
 

posted on 2022-12-07 21:48  wsk3q  阅读(174)  评论(0编辑  收藏  举报