Author Topic: Problem with arguments and preprocesing only  (Read 9114 times)

Offline Borneq

  • Jr. Member
  • *
  • Posts: 26
Problem with arguments and preprocesing only
« on: December 12, 2012, 11:18:14 PM »
In standard nasmx example demo1 for win32 is
;// the start of our program as defined with the ENTRY macro
proc   demo1, ptrdiff_t argcount, ptrdiff_t cmdline
locals none
    invoke    my_p, szContentTwo, szTitleTwo
    invoke    MessageBox, NULL, szContent, szTitle, MB_OK
    invoke    ExitProcess, NULL
endproc
If I try use argcount: mov eax,argcount is error: symbol `argcount' undefined
If I try preproces only -E is errors:
..\..\..\inc\nasmx.inc:358: error: symbol references not supported in preprocess-only mode
..\..\..\inc\nasmx.inc:358: error: non-constant value given to `%assign'
..\..\..\inc\nasmx.inc:360: fatal: unknown size0_t: 0

Offline Mathi

  • Jr. Member
  • *
  • Posts: 82
  • Country: in
    • Win32NASM
Re: Problem with arguments and preprocesing only
« Reply #1 on: December 13, 2012, 02:01:34 AM »
The syntax for referring to the function parameters is  (Only when using NASMX macro)

argv(.paramname)

Try,
mov    eax, uint32_t [argv(.argcount)]
or
mov     eax,  [argv(.argcount)]


Yeah, for a workaround for -E switch issue, you can add

%define __BITS__ 32

in your source file.

Thanks,
Mathi.
« Last Edit: December 13, 2012, 05:00:07 AM by Mathi »

Offline Borneq

  • Jr. Member
  • *
  • Posts: 26
Re: Problem with arguments and preprocesing only
« Reply #2 on: December 13, 2012, 08:19:21 AM »
Thanks, all works!
In Nasm starting procedure:
proc   demo1, ptrdiff_t argcount, ptrdiff_t cmdline
gets argcount and cmdline like C programs ? cmdline is string table or one string?

Offline Mathi

  • Jr. Member
  • *
  • Posts: 82
  • Country: in
    • Win32NASM
Re: Problem with arguments and preprocesing only
« Reply #3 on: December 13, 2012, 08:53:22 AM »
Checkout the linux example in NASMX package. I guess it should work for win32 too.
demos\linux\DEMO3\demo3.asm

Regards,
Mathi.