The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => Topic started by: gabalwto on August 31, 2010, 04:23:07 AM

Title: About MASM macro label
Post by: gabalwto on August 31, 2010, 04:23:07 AM
MASM macro use local label for each callers, when it called, the local label is replaced by a unique label. such like ??0001

Now I write a macro uses serval local labels,Once I use it for many times the error occured.Then I use /EP option to output preprocessed code,I find the unique label scroll back to ??0000。

I known the maximum number of unique label now in MASM32 is 0xFFFF,How can I solve this problem?

PS: I'm sorry for my poor English!!
Title: Re: About MASM macro label
Post by: jj2007 on August 31, 2010, 08:14:33 AM
Try using two global variables:
include \masm32\include\masm32rt.inc

TheCt = 0
ManyVars MACRO
  TheCt = TheCt +1
  tmp$ CATSTR <MyLabel>, %TheCt
ENDM

.code
AppName db "Masm32:", 0

start:
REPEAT 100000
ManyVars
ENDM
% echo tmp$
MsgBox 0, "Hello World", addr AppName, MB_OK
exit

end start

You will see MyLabel100000 in the output window.
Title: Re: About MASM macro label
Post by: gabalwto on September 01, 2010, 02:07:54 AM
Oh,That's seems to be a good idea!

Thank you very much!!
Title: Re: About MASM macro label
Post by: gabalwto on September 03, 2010, 03:06:10 PM
Well, I find another problem, such label $tmp can not be used for its CATSTR operation.(i mean what label the $tmp stand for)
Title: Re: About MASM macro label
Post by: jj2007 on September 03, 2010, 03:24:25 PM
Quote from: gabalwto on September 03, 2010, 03:06:10 PM
Well, I find another problem, such label $tmp can not be used for its CATSTR operation.(i mean what label the $tmp stand for)

Can you post example code please?
Title: Re: About MASM macro label
Post by: gabalwto on October 02, 2010, 05:46:34 PM
Well,I have solved my problem. A global label that represented another label can not join the CATSTR SUBSTR expression calculate,finally,I use a for statement to make the calculation enabled.