Author Topic: Win32 local variables  (Read 16785 times)

Offline avcaballero

  • Full Member
  • **
  • Posts: 133
  • Country: es
    • Abre los Ojos al Ensamblador
Win32 local variables
« on: April 13, 2010, 09:10:57 AM »
Hello. Is there a way to define local variables inside a procedure as masm local "LOCAL myvar:DWORD" alike for example. I have revised win32 demos from nasmx package and I haven't found any.

Thank you

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Win32 local variables
« Reply #1 on: April 13, 2010, 05:46:40 PM »
The NASMX way:
Code: [Select]
proc app
 LOCALS
  LOCAL stackvar, DWORD
 ENDLOCALS
 ;... rest of proc code...
endproc

The NASM way: Stack Relative Preprocessor Directives.

Between the two, I would go with the one that has better documentation :P

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Win32 local variables
« Reply #2 on: April 15, 2010, 08:31:51 PM »
Since Nasm expects macro parameters to be separated by commas, it's going to have trouble with "myvar:dword". With the (relatively new) substring capabilities, it "should" be possible to "parse" for the colon, and make two parameters out of one. If you can live with the comma, Alfonso, that would be much easier.

Best,
Frank