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 badges1 Answer
Reset to default 2I 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