小编vso*_*oni的帖子

将内联汇编代码转换为C++

我正在研究一个cpp项目.该项目需要迁移到64位.它包含一些无法在x64上编译的内联汇编代码.这是包含汇编代码的函数:

void ExternalFunctionCall::callFunction(ArgType resultType, void* resultBuffer)
{
#if defined(_NT_) || defined(__OS2__)

    // I386

    // just copy the args buffer to the stack (it's already layed out correctly)
    int* begin = m_argsBegin;
    int* ptr = m_argsEnd;
    int arr[1000], i=0;
    while (ptr > begin) {
        int val = *(--ptr);

        __asm push val
    }

    void* functionAddress = m_functionAddress;

    // call the function & handle the return value.  use __stdcall calling convention
    switch (resultType) {
    case voidType:
        __asm {
            call functionAddress
        }
        break;
    case …
Run Code Online (Sandbox Code Playgroud)

c++ inline-assembly

6
推荐指数
2
解决办法
1864
查看次数

标签 统计

c++ ×1

inline-assembly ×1