• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 42  文章 - 3  trackbacks - 0
            <2012年7月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(2)

            隨筆檔案

            文章檔案

            網頁收藏

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

             
            在編寫共享庫時,為保證ABI(app binary interface)兼容:
              1 盡量使用C語言 2不要在接口類使用虛函數和模板; 3 不要改變成員函數的訪問權限; 4 不要使用STL 5 不要依賴使用虛擬析構函數,最好自己實現,顯式調用;
            6 不要在DLL里面申請內存,DLL外釋放,DLL和APP可能不在同一個內存堆;

            可重入(reentrant)函數可以由多于一個任務并發使用,而不必擔心數據錯誤。相反, 不可重入(non-reentrant)函數不能由超過一個任務所共享,除非能確保函數的互斥(或者使用信號量,或者在代碼的關鍵部分禁用中斷)。可重入函數可以在任意時刻被中斷,稍后再繼續運行,不會丟失數據。可重入函數要么使用本地變量,要么在使用全局變量時保護自己的數據。
            Reentrant Function:A function whose effect, when called by two or more threads,is guaranteed to be as if the threads each executed thefunction one after another in an undefined order, even ifthe actual execution is interleaved.
            Thread-Safe Function:A function that may be safely invoked concurrently by multiple threads.

            函數可重入的必要條件:
            1 不使用任何(局部)靜態變量或者全局的非常量;
            2 不返回任何局部靜態或者全局非常量指針;
            3 僅依賴調用方的參數;
            4 不依賴任何單個資源的鎖;
            5 不調用任何不可重入的函數;

            In classical OS, stack grows downwards. After each push operatation, the value of ebp becomes small, and vice versa.

            esp is the top of the stack.

            ebp is usually set to esp at the start of the function. Local variables are accessed by subtracting a constant offset from ebp. All x86 calling conventions define ebp as being preserved across function calls. ebp itself actually points to the previous frame's base pointer, which enables stack walking in a debugger and viewing other frames local variables to work.

            Most function prologs look something like:
            push ebp      ; Preserve current frame pointer
            mov ebp, esp  ; Create new frame pointer pointing to current stack top
            sub esp, 20   ; allocate 20 bytes worth of locals on stack. 

            Then later in the function you may have code like (presuming both local variables are 4 bytes)
            mov [ebp-4], eax    ; Store eax in first local
            mov ebx, [ebp - 8]  ; Load ebx from second local

            objdump is a program for displaying various information about object files. For instance, it can be used as a disassembler to view executable in assembly form. It is part of the GNU Binutils for fine-grained control over executable and other binary data.

            For example, to completely disassemble a binary:
            objdump -Dslx file


            posted on 2012-07-17 22:20 鷹擊長空 閱讀(316) 評論(0)  編輯 收藏 引用
            国产香蕉97碰碰久久人人| 精品久久久无码21p发布| 97久久婷婷五月综合色d啪蜜芽| 久久99精品国产麻豆蜜芽| 97久久超碰国产精品2021| 伊人久久大香线焦AV综合影院| 狠狠色丁香婷婷久久综合五月| 欧美一级久久久久久久大| 久久久久久A亚洲欧洲AV冫| 色偷偷88欧美精品久久久| 无码人妻少妇久久中文字幕| 一本久久a久久精品综合香蕉| 色诱久久av| 亚洲中文字幕久久精品无码APP| 2020久久精品亚洲热综合一本| 综合人妻久久一区二区精品| 久久精品国产亚洲AV无码偷窥 | 99热精品久久只有精品| 亚洲国产成人久久综合一| 亚洲欧美日韩精品久久| 久久99国产精品成人欧美| 亚洲精品视频久久久| 99久久精品免费看国产一区二区三区| 久久综合亚洲色HEZYO社区| 久久中文骚妇内射| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久国产乱子伦精品免费强| 999久久久免费国产精品播放| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 久久久久久午夜成人影院| 久久无码av三级| 久久精品国产亚洲av麻豆蜜芽| aaa级精品久久久国产片| 久久久久这里只有精品 | 久久九九久精品国产免费直播| 97久久超碰国产精品旧版| 亚洲国产精品狼友中文久久久| 亚洲AV无码1区2区久久| 久久91精品综合国产首页| 精品久久久久久国产潘金莲|