The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: jj2007 on June 08, 2009, 09:26:19 PM

Title: Label, forward reference and opattr
Post by: jj2007 on June 08, 2009, 09:26:19 PM
I am aware of this thread (http://www.masm32.com/board/index.php?topic=2567.msg20327#msg20327), but it didn't solve my problem:

codesize macro algo
  print "size="
  mov eax, offset &algo&_END-&algo&
  print str$(eax), 13, 10
ENDM
...
MyAlgo proc
  ret
MyAlgo endp
MyAlgo_END:


That works. However, I would like to check whether MyAlgo_END exists, and there I am in trouble:
- ifndef fails:
         tmp$ CATSTR <algo>, <_END>
         ifdef tmp$
.. and various other constructs like &algo&_END etc return either always "defined" or always "undefined".
- opattr fails for MyAlgo_END because it is a forward reference
Now my question:
opattr works for MyAlgo because MyAlgo is a proc and defined via PROTO. Is there a similar way to pre-define the label?
Thanks for any hint.

EDIT: I found the solution (in an old code of mine ::))

Externdef MyAlgo_END:NEAR