flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > use "EQU" constant as procedure name

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 06 Jan 2017, 19:16
Hi,

I'm struggling using a constant (defined with EQU or "=") as function name. Example:

Code:
FUNCTION_NAME = FunctionPoly1

macro POLY_FUNCTION 
{
    proc FUNCTION_NAME 

        mov     eax, eax 
        ret

    endp
}


.code 

POLY_FUNCTION

    


But I get the following error:

FASM: error : undefined symbol 'FunctionPoly1'

Is it possible to do a similar approach? Where I defined a CONSTANT and it will be used as function name?

Thanks!
[/i]
Post 06 Jan 2017, 19:16
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 06 Jan 2017, 19:20
If you use EQU instead of "=" it should work correctly. An EQU defines a textual substitution.
Post 06 Jan 2017, 19:20
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 06 Jan 2017, 19:22
Hi Tomasz,

Thanks a lot! Sorry, I tried before with EQU and it failed (I think I had another syntax error). I have tried with EQU and it works perfect! Sorry, my bad!

Thanks!!
Post 06 Jan 2017, 19:22
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 674
l4m2 20 Jan 2017, 09:34
Code:
macro f {
  display 'f'
  f equ g
}
h equ g
macro g {
  display 'g'
}
f
f
h     

I got "Illegal instruction" at "g"?
Post 20 Jan 2017, 09:34
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.