最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

assembly - How to call a function in MASM ML64 that has the same name as a reserved word - Stack Overflow

programmeradmin2浏览0评论

closely related to how to create a MASM/ML64 proc with the same name as a reserved word

On the other side now, I need to call a function called, say, add. Generated by a different compiler, so its really called add

The alias trick does not work, no matter what I try

This got me close-ish

call _add
.....
option nokeyword: <add>
alias <add> = <_add>
EXTERN _add:PROC

but not really. It works when I call my add, buts calling via the _add name

I can feel myself being drawn to nasm

closely related to how to create a MASM/ML64 proc with the same name as a reserved word

On the other side now, I need to call a function called, say, add. Generated by a different compiler, so its really called add

The alias trick does not work, no matter what I try

This got me close-ish

call _add
.....
option nokeyword: <add>
alias <add> = <_add>
EXTERN _add:PROC

but not really. It works when I call my add, buts calling via the _add name

I can feel myself being drawn to nasm

Share Improve this question asked Mar 18 at 22:33 pm100pm100 50.4k24 gold badges92 silver badges154 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

I think I got it, and you were pretty close. The trick I found is that you need to set your alias at the beginning of the file so that you have some valid name to use in all your call instructions, but set nokeyword at the end of the file, so that you can do your EXTERN directives with the original names, which it needs.

By the way, I found that you can use an @ symbol or ? for the mangling, which is useful, because they're not valid C identifiers.

INCLUDELIB msvcrt.lib
                    
PUBLIC main

ALIAS <@add> = <add>

.DATA
.CODE
                         
main PROC
...
    call @add
...
main ENDP

option nokeyword: <add>
EXTERN add:PROC

END
发布评论

评论列表(0)

  1. 暂无评论