flat assembler
Message board for the users of flat assembler.

Index > Main > if ~defined blaa problem

Author
Thread Post new topic Reply to topic
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
What's wrong with this?
Code:
if ~defined GetFilePart
        extrn '_GetFilePart@8' as GetFilePart:dword
end if    


I'm getting this when compiling one of the sources including the .inc file where the code above is in:
Quote:
flat assembler version 1.67.6 (567458 kilobytes memory)
error: code cannot be generated.
*** Error code: 255 ***


All the files including that seem to be doing this, bug in if ~defined?

_________________
When We Ride On Our Enemies
support reverse smileys |:
Post 08 Aug 2006, 03:04
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I can't believe this still isn't in the FAQ. Tomasz, place it there.

"defined" operator means "defined anywhere in source", not "defined previously in source" like in C. and "if a is not defined then a is defined" is paradox, there is no way to interpret it, and so code cannot be generated Razz

if you want "defined previously" then i suggest this macro:
Code:
;==============================================
;ifndef
;desc: checks if expression (usually symbol) is not "defined" previously
;      in code (not in whole file, like with "if ~defined expr")
;args: expr - any expression acceptable as argument to "defined" operator
;note: end block with "end if", just like any "if" command
macro ifndef expr*
{
   local ..HERE
   if defined ..HERE | ~ defined expr
     ..HERE = 1
}

ifndef GetFilePart 
        extrn '_GetFilePart@8' as GetFilePart:dword 
end if
    
Post 08 Aug 2006, 08:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
heh, thanks for the macro
I did read manual about if ~defined but I think I got it wrong Razz
Post 08 Aug 2006, 09:58
View user's profile Send private message MSN Messenger 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.