flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macros not working properly

Author
Thread Post new topic Reply to topic
pjd



Joined: 15 Jul 2007
Posts: 47
pjd 09 Aug 2007, 10:09
Why isn't this doing what I think it should do?

Code:
IDATA_SECTION '.idata'                      ;call the macro

macro IDATA_SECTION name               ;declare the macro
{   section name import data readable writeable     }
    


Which should expand to
Code:
section '.idata' import data readable writeable
    


both the declaration and the call are in the same file so it's not that fasm can't find the declaration.

fasm complains that the call line is an illegal instruction
Post 09 Aug 2007, 10:09
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 09 Aug 2007, 10:53
This code compiles without errors:
Code:
format PE GUI 4.0

macro IDATA_SECTION name               ;declare the macro
{       section name import data readable writeable     }

IDATA_SECTION '.idata'    
Post 09 Aug 2007, 10:53
View user's profile Send private message Visit poster's website Reply with quote
pjd



Joined: 15 Jul 2007
Posts: 47
pjd 09 Aug 2007, 12:41
yeah that works.
I thought fasm did extra passes to allow things to be called before they are declared
Post 09 Aug 2007, 12:41
View user's profile Send private message Reply with quote
Mr_Silent



Joined: 25 Apr 2006
Posts: 30
Mr_Silent 09 Aug 2007, 17:31
Assembler does multiple passes, preprocessor does not. Macros are handled by preprocessor.
Post 09 Aug 2007, 17:31
View user's profile Send private message Reply with quote
pjd



Joined: 15 Jul 2007
Posts: 47
pjd 10 Aug 2007, 09:38
thanks
Post 10 Aug 2007, 09:38
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.