<tfoot id='bUGoH'></tfoot>
    • <bdo id='bUGoH'></bdo><ul id='bUGoH'></ul>
  1. <small id='bUGoH'></small><noframes id='bUGoH'>

    1. <legend id='bUGoH'><style id='bUGoH'><dir id='bUGoH'><q id='bUGoH'></q></dir></style></legend>

      <i id='bUGoH'><tr id='bUGoH'><dt id='bUGoH'><q id='bUGoH'><span id='bUGoH'><b id='bUGoH'><form id='bUGoH'><ins id='bUGoH'></ins><ul id='bUGoH'></ul><sub id='bUGoH'></sub></form><legend id='bUGoH'></legend><bdo id='bUGoH'><pre id='bUGoH'><center id='bUGoH'></center></pre></bdo></b><th id='bUGoH'></th></span></q></dt></tr></i><div id='bUGoH'><tfoot id='bUGoH'></tfoot><dl id='bUGoH'><fieldset id='bUGoH'></fieldset></dl></div>
    2. 如何指定 vc11 lambda 调用约定

      时间:2023-10-06
      <tfoot id='g5TfH'></tfoot>
        <legend id='g5TfH'><style id='g5TfH'><dir id='g5TfH'><q id='g5TfH'></q></dir></style></legend>

            <bdo id='g5TfH'></bdo><ul id='g5TfH'></ul>
              <tbody id='g5TfH'></tbody>
            <i id='g5TfH'><tr id='g5TfH'><dt id='g5TfH'><q id='g5TfH'><span id='g5TfH'><b id='g5TfH'><form id='g5TfH'><ins id='g5TfH'></ins><ul id='g5TfH'></ul><sub id='g5TfH'></sub></form><legend id='g5TfH'></legend><bdo id='g5TfH'><pre id='g5TfH'><center id='g5TfH'></center></pre></bdo></b><th id='g5TfH'></th></span></q></dt></tr></i><div id='g5TfH'><tfoot id='g5TfH'></tfoot><dl id='g5TfH'><fieldset id='g5TfH'></fieldset></dl></div>

              <small id='g5TfH'></small><noframes id='g5TfH'>

              • 本文介绍了如何指定 vc11 lambda 调用约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想将嵌套在类中的 lambda 函数指针传递给 Windows API 回调函数.我发现没有地方可以指定 __stdcall 关键字.有人告诉我编译只支持__cdecl,但是我用nm命令转储obj文件后,发现编译会生成三个辅助函数(__stdcall>__cdecl, __fastcall) 同时进行.所以我的问题是,如何指定调用约定?

                I want to pass a lambda function pointer, which nested in a class, to the Windows API callback function. I found there is no place for me to specify the __stdcall keyword. Some people told me the compile only support __cdecl, but after I used nm command to dump the obj file, I found the compile will generate three helper function (__stdcall, __cdecl, __fastcall) concurrently. So my problem is, how can I specify the calling convention?

                以下代码是我的测试代码.

                Those following code are my test code.

                #include "stdafx.h"
                int _tmain(int argc, _TCHAR* argv[])
                {
                    auto func = [](){};
                    return 0;
                }
                

                00000000 t ?<helper_func_cdecl>@<lambda_5738939ec88434c53e1a446c47cf2db6>@@CAXXZ
                00000000 t ?<helper_func_fastcall>@<lambda_5738939ec88434c53e1a446c47cf2db6>@@CIXXZ
                00000000 t ?<helper_func_stdcall>@<lambda_5738939ec88434c53e1a446c47cf2db6>@@CGXXZ
                00000000 t ??B<lambda_5738939ec88434c53e1a446c47cf2db6>@@QBEP6AXXZXZ
                00000000 t ??B<lambda_5738939ec88434c53e1a446c47cf2db6>@@QBEP6GXXZXZ
                00000000 t ??B<lambda_5738939ec88434c53e1a446c47cf2db6>@@QBEP6IXXZXZ
                00000000 t ??R<lambda_5738939ec88434c53e1a446c47cf2db6>@@QBEXXZ
                

                推荐答案

                Cast it:

                WinApiFunc(static_cast<void(__stdcall *)()>(func));
                

                或者先存入局部变量:

                void (__stdcall *funcp)() = func;
                WinApiFunc(funcp);
                

                这篇关于如何指定 vc11 lambda 调用约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何找出 cl.exe 的内置宏 下一篇:如何查看 Visual C++ 预处理器的输出?

                相关文章

                最新文章

                1. <small id='modA8'></small><noframes id='modA8'>

                2. <tfoot id='modA8'></tfoot>
                    <bdo id='modA8'></bdo><ul id='modA8'></ul>
                3. <i id='modA8'><tr id='modA8'><dt id='modA8'><q id='modA8'><span id='modA8'><b id='modA8'><form id='modA8'><ins id='modA8'></ins><ul id='modA8'></ul><sub id='modA8'></sub></form><legend id='modA8'></legend><bdo id='modA8'><pre id='modA8'><center id='modA8'></center></pre></bdo></b><th id='modA8'></th></span></q></dt></tr></i><div id='modA8'><tfoot id='modA8'></tfoot><dl id='modA8'><fieldset id='modA8'></fieldset></dl></div>

                  1. <legend id='modA8'><style id='modA8'><dir id='modA8'><q id='modA8'></q></dir></style></legend>