News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

#define

Started by Citric, May 11, 2005, 10:20:52 AM

Previous topic - Next topic

Citric

Hi All

i am try to work on some test code with a macro(#define) but #if .... #endif always seems to turn out false, from the code below the linker can not find the symbol "__variable__" and the list file doesnt contain anything in side the #if ... #endif

has anyone expearenced this?

the code follows below.

Cheers Adam


#define tester(%one, %two) = \
    #if(__variable__defined__ != 1) \
        #define __variable__defined__ 1 \
\
        DATA SECTION \
        __variable__ DD 0 \
\
        CODE SECTION \
    #endif \
\
    mov D[__variable__], %one

wjr

FYI the first line doesn't need both #define and =, either one will do. The problem occurs on the second line in evaluating the #if expression with __variable__defined__  when not already defined. If you do not use __variable__defined__  anywhere else, try the following instead...


#define tester(%one, %two) \
    #ifndef __variable__  \
\
        DATA SECTION \
        __variable__ DD 0 \
\
        CODE SECTION \
    #endif \
\
    mov D[__variable__], %one