• <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>

            天下

            記錄修行的印記

            Double Thunking


            By default, when compiling with /clr (not /clr:pure), the definition of a managed function causes the compiler to generate a managed entry point and a native 

            entry point. This allows the managed function to be called from native and managed call sites. However, when a native entry point exists, it can be the entry 
            point for all calls to the function. If a calling function is managed, the native entry point will then call the managed entry point. In effect, two calls 
            are required to invoke the function (hence, double thunking). For example, virtual functions are always called through a native entry point.
            One resolution is to tell the compiler not to generate a native entry point for a managed function, that the function will only be called from a managed 
            context, by using the __clrcall calling convention.
            Similarly, if you export (dllexport, dllimport) a managed function, a native entry point is generated and any function that imports and calls that function 
            will call through the native entry point. To avoid double thunking in this situation, do not use native export/import semantics; simply reference the 
            metadata via #using (see The #using Directive).
            In Visual C++ 2005 the compiler was updated to reduce unnecessary double thunking. For example, any function with a managed type in the signature (including 
            return type) will implicitly be marked as __clrcall. For more information on double thunk elimination, see 
            http://msdn.microsoft.com/msdnmag/issues/05/01/COptimizations/default.aspx.
            Example
            The following sample demonstrates double thunking. When compiled native (without /clr), the call to the virtual function in main generates one call to T's 
            copy constructor and one call to the destructor. Similar behavior is achieved when the virtual function is declared with /clr and __clrcall. However, when 
            just compiled with /clr, the function call generates a call to the copy constructor but there is another call to the copy constructor due to the 
            native-to-managed thunk.
            純 MSIL 程序集可以調用非托管函數,但不能由非托管函數調用。因此,與非托管函數使用的服務器代碼相比,純 MSIL 更適合于使用非托管函數的客戶端代碼。
            當我們使用/clr選項(不是/clr:pure)進行編譯的時候,一個托管函數(managed function),會導致編譯器生成一個托管的入口點(managed entry point)和一個原生的入口點
            (native entry point),這樣可以使得托管函數既可以被托管代碼調用,也可以被原生代碼調用。但是,當一個原生的入口點存在的時候,它將成為所有調用的入口點。也就是說
            如果調用者是托管的,它還是會先去調用原生入口點,然后原生的入口點再去調用托管的入口點,這就意味著調用了兩次函數入口點(Double Thunking)。 



            c++ cli 標準

            posted on 2015-12-01 11:14 天下 閱讀(333) 評論(0)  編輯 收藏 引用 所屬分類: C#

            <2012年2月>
            2930311234
            567891011
            12131415161718
            19202122232425
            26272829123
            45678910

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            国产成人无码精品久久久久免费| 精品99久久aaa一级毛片| 一级做a爰片久久毛片看看| 91久久精品无码一区二区毛片| 久久精品国产一区二区三区日韩| 久久精品国产91久久麻豆自制| 99久久www免费人成精品| 久久久久99精品成人片| 无码国内精品久久人妻蜜桃| 国产美女久久久| 伊人色综合九久久天天蜜桃| 精品久久8x国产免费观看| 激情综合色综合久久综合| 免费精品国产日韩热久久| 99久久99久久| 亚洲精品无码久久久| 国内精品久久久久久野外| 伊人久久大香线蕉成人| 狠狠狠色丁香婷婷综合久久俺| 久久这里都是精品| 久久久久久久99精品免费观看| 亚洲?V乱码久久精品蜜桃| 热99re久久国超精品首页| 亚洲成色www久久网站夜月| 91精品无码久久久久久五月天| 伊人久久久AV老熟妇色| 青青久久精品国产免费看| 91麻豆精品国产91久久久久久| 久久99精品久久久久子伦| 久久久精品国产免大香伊| 一本久久精品一区二区| 久久亚洲电影| 午夜精品久久久久久影视777| 一本久久久久久久| 久久免费精品视频| 狠狠久久亚洲欧美专区| 精品久久久久久中文字幕人妻最新| 精品国产青草久久久久福利| 久久久久国产精品人妻| 中文字幕久久波多野结衣av| 伊人久久大香线蕉亚洲五月天|