nidud / asmc

Masm compatible assembler
GNU General Public License v2.0
50 stars 6 forks source link

Issue with ALIAS #8

Closed Erol-2022 closed 7 months ago

Erol-2022 commented 8 months ago

Hi Nidud,

Poasm v12 can assemble the code below without any issues :

.386
.model flat,stdcall
option casemap:none

OutputText PROTO C :DWORD,:VARARG

ALIAS <OutputText>=<printf>

END

printf is exported by msvcrt.lib The purpose is to map the new symbol OutputText to the printf function.

Trying to assemble with asmc :

asmc.exe /coff Alias.asm

Asmc Macro Assembler Version 2.34.50
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: Alias.asm
Alias.asm(7) : error A2005: symbol redefinition : OutputText
nidud commented 8 months ago

Asmc (and Masm) wont allow a direct redefinition of symbols like this. The syntax is:

ALIAS <alias> = <actual-name>

It's possible to use the UNDEF directive here thought:

.386
.model flat,stdcall
option casemap:none

printf      proto c :ptr, :vararg
OutputText  proto c :ptr, :vararg

undef OutputText
ALIAS <OutputText>=<printf>

.code
OutputText("%s(%d)\n", __FILE__, __LINE__)
end
Erol-2022 commented 8 months ago

Hi Nidud,

Thanks for the explanation. I tested your example code.

nidud commented 7 months ago

Haven't thought about using ALIAS like this but it's actually more practical than adding global labels.

memmove::
memcpy proc dst:ptr, src:ptr, size:size_t