Can someone please tell me how local labels work on WLA?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Can someone please tell me how local labels work on WLA?
by on (#212028)
I guess this is fairly trivial but I read the WLA documentation and used search engines and I can't understand were the problem is,
So, if someone is kind enough to tell me what is wrong with this I will be very glad.

So, I have an .ENUM inside a .SECTION like this:

Code:
.SECTION "section name" SEMIFREE
.ENUM $00
       _local_label dw
.ENDE

.ENDS


and then I have the same exact enum inside of another .SECTION

As far as I know the underscore makes the label local to the section were the .ENUM is,
So there shouldn't be any collisions with labels in other sections, yet WLA-DX says DIRECTIVE_ERROR: "_local_label" was defined for the second time.
Strangely enough, when using .ENUM, WLA-DX throws the DIRECTIVE_ERROR and doesn't generate any obj file, but if I use .DEFINE instead, it throws the same error but it does generate an object file ¿?

I also tried using @local_label and I got the same result.

There is anything I'm missing out?
Re: Can someone please tell me how local labels work on WLA?
by on (#212120)
OK, I think that I get it now
Underscore for local section labels only work with labels defined within the code.

Labels defined with .DEFINE( or .DEF .EQU .ENUM which are the same) are always in the module file scope,
labels defined with .DEF .EQU or .ENUM also do not show in the object symbol table unless you use .EXPORT
I can have the same .DEFINE in two different modules but not in the same one.

I guess I will have to use .RAMBANKS .STRUCT or whatever WLA has to offer, I wanted to use .ENUMS/.DEFINES thought,
as I only wanted to give names to the offset values of my local vars at to the stack.

Also if I understand it right, WLA Directives are a kind of minilanguage, is not like the C preprocessor that only expands text, C defines never show up on the symbol table since they are expanded out at preprocessing time( so just text expanding is performed)