flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > confuse of using define preprocessor directive

Author
Thread Post new topic Reply to topic
primer



Joined: 05 Nov 2010
Posts: 12
primer
Hi all!
I'm confusing of using define, I've added this code to win32ax.inc

Code:
if defined CRT
 display "CRT defined",13,10
       display CRT,13,10
else
   define CRT 'msvcrt.dll'
   display "use default CRT",13,10
   display CRT,13,10
end if
    

and in my program
Code:
format PE console
define CRT 'msvcr100.dll'
include 'win32ax.inc'
display CRT
.code
start:
        invoke ExitProcess,0
.end start
    

and it print in compile console
Code:
flat assembler  version 1.69.25  (1229413 kilobytes memory)
CRT defined
msvcr100.dll
msvcrt.dll
3 passes, 0.1 seconds, 2048 bytes.
    

so I don't know why it set CRT to msvcrt.dll?
Post 16 Nov 2010, 13:28
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
DEFINE is handled by the preprocessor before code is processed by assembler. IF/ELSE are handled by assembler. This separation between preprocessor and assembler is most important -- like two completely different languages -- like using PHP to generate content for browser.
Post 16 Nov 2010, 14:07
View user's profile Send private message Visit poster's website Reply with quote
primer



Joined: 05 Nov 2010
Posts: 12
primer
bitRAKE wrote:
DEFINE is handled by the preprocessor before code is processed by assembler. IF/ELSE are handled by assembler. This separation between preprocessor and assembler is most important -- like two completely different languages -- like using PHP to generate content for browser.


understood Smile , thank you.
Post 16 Nov 2010, 15:45
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
But we have to admit, that using "define" and "defined" in such different meanings is somehow confusing for beginners... Smile
Post 16 Nov 2010, 17:06
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.