flat assembler
Message board for the users of flat assembler.

Index > Main > Conditional compiling

Author
Thread Post new topic Reply to topic
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 04 Sep 2010, 19:34
I took this from the manual, but I can't get it to work, how can I choose between a debug and release version?

Code:
                DEBUG   = TRUE
                match   =TRUE, DEBUG {include 'importd.s'} <-- does not get included    

_________________
This is a block of text that can be added to posts you make.
Post 04 Sep 2010, 19:34
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 05 Sep 2010, 00:08
You need to use 'equ'.
Code:
DEBUG equ TRUE    
Post 05 Sep 2010, 00:08
View user's profile Send private message Visit poster's website Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 05 Sep 2010, 00:49
All right.

How do I do the converse, do something when DEBUG is undefined for example?
Post 05 Sep 2010, 00:49
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 05 Sep 2010, 01:01
If DEBUG has never been defined:
Code:
match =DEBUG,DEBUG { ... }    
Post 05 Sep 2010, 01:01
View user's profile Send private message Visit poster's website Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 05 Sep 2010, 09:08
Thanks. Can I use this inside macros to make them behave differently according to DEBUG? I tried with my import macro, but fasm didn't like it.

Code:
macro import [dll,functions]
{
   dd 0,0,0,dll#.name-imgbase,dll#.iat-imgbase
common
   dd 5 dup 0
   idata.size = $-idata
match   =TRUE, DEBUG {
forward
   dll#.ilt: irp function,functions
   \{
      dd function\#.name-imgbase
   \}
   dd 0
}
forward
   dll#.iat: irp function,functions
   \{
      function: dd function\#.name-imgbase
   \}
   dd 0
forward
   dll#.name: db `dll,0
forward
   irp function, functions
   \{  <--- Error: unexpected characters, or undefined symbols when i escape the brackets
      align 2
      function\#.name: dw 0
      db \`function,0
   \}
}    
Post 05 Sep 2010, 09:08
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 05 Sep 2010, 09:16
Remember to escape the {} used by match
Code:
macro {
  match \{
    irp \\{
      ;...
    \\}
  \}
}    
Post 05 Sep 2010, 09:16
View user's profile Send private message Visit poster's website Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 05 Sep 2010, 23:38
Awesome, I forgot to escape the # in there.

It makes an awful clutter, perhaps it's best to make separate imports instead.
Post 05 Sep 2010, 23:38
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number 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.