flat assembler
Message board for the users of flat assembler.

Index > Windows > FASM2 PROC macro issue

Author
Thread Post new topic Reply to topic
edcdecl



Joined: 26 Apr 2024
Posts: 2
Location: United States
edcdecl 22 Nov 2025, 18:06
Trying to do something like the following in FASM2 will not assemble:

Code:

proc last_error_to_global_string, error_code:DWORD
        stdcall last_error_to_string,\
                global_last_error_string,\
                global_last_error_string.len,\
                [error_code]

        mov eax, global_last_error_string

        ret
endp

proc last_error_to_string, out_msg:DWORD, out_msg_len:DWORD, error_code:DWORD
        invoke FormatMessageA,\
                FORMAT_MESSAGE_FROM_SYSTEM+FORMAT_MESSAGE_IGNORE_INSERTS,\
                NULL,\
                [error_code],\
                0,\
                [out_msg],\
                [out_msg_len],\
                NULL

        test eax, eax
        jz .fma_failed

        ret

.fma_failed:
        ;  TODO

endp

    


Because the assembler will say that the symbol "error_code" is defined twice.

Unless I am missing something.

I am using the "win32axp.inc" include.

Thanks.
Post 22 Nov 2025, 18:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8483
Location: Kraków, Poland
Tomasz Grysztar 22 Nov 2025, 18:29
There was an issue with context inheritance that caused these labels to be declared as global instead of local. Easily fixed by pushing the context evaluation down the stream.

Thank you for the report!
Post 22 Nov 2025, 18:29
View user's profile Send private message Visit poster's website Reply with quote
edcdecl



Joined: 26 Apr 2024
Posts: 2
Location: United States
edcdecl 22 Nov 2025, 18:32
Thank you so much!
Post 22 Nov 2025, 18:32
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8483
Location: Kraków, Poland
Tomasz Grysztar 22 Nov 2025, 18:52
I also made a slightly different fix in fasmg's general repository. This one would work with somewhat older versions of fasmg (although that probably doesn't matter much).
Post 22 Nov 2025, 18:52
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.