国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

解決exe和DLL直接傳遞FILE 指針崩潰的問題

2019-11-08 20:11:26
字體:
供稿:網(wǎng)友

EXE程序和DLL之間可能傳遞FILE指針,但是可能會造成程序崩潰。這是由于_lock_file引起的

[cpp] view plain copy PRint?void __cdecl _lock_file (          FILE *pf          )  {          /*          * The way the FILE (pointed to by pf) is locked depends on whether          * it is part of _iob[] or not          */          if ( (pf >= _iob) && (pf <= (&_iob[_IOB_ENTRIES-1])) )          {              /*              * FILE lies in _iob[] so the lock lies in _locktable[].              */              _lock( _STREAM_LOCKS + (int)(pf - _iob) );              /* We set _IOLOCKED to indicate we locked the stream */              pf->_flag |= _IOLOCKED;          }          else              /*              * Not part of _iob[]. Therefore, *pf is a _FILEX and the              * lock field of the struct is an initialized critical              * section.              */              EnterCriticalSection( &(((_FILEX *)pf)->lock) );  }  

if ( (pf >= _iob) && (pf <= (&_iob[_IOB_ENTRIES-1])) ) 把fp和一個全局變量_iob比較,exe和DLL可能會有不同的全局變量,這導(dǎo)致fp不在_iob數(shù)組的范圍內(nèi),導(dǎo)致出現(xiàn)錯誤。

解決的頒發(fā)是exe和DLL都動態(tài)連接到CRT,或者把DLL編譯成靜態(tài)庫。

 

轉(zhuǎn)自:http://blog.csdn.net/leechiyang/article/details/6873952


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 澜沧| 宜君县| 邵东县| 楚雄市| 田林县| 丹凤县| 温泉县| 拉萨市| 蓝田县| 杭锦旗| 两当县| 陕西省| 磐石市| 贺州市| 墨江| 墨脱县| 读书| 庆安县| 凭祥市| 察雅县| 绥宁县| 曲阜市| 津市市| 原阳县| 西平县| 伊宁市| 全椒县| 中超| 东源县| 绥芬河市| 高陵县| 屏边| 北宁市| 岳阳县| 红河县| 牙克石市| 沙坪坝区| 莒南县| 古交市| 宣城市| 常山县|