News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

errors between 1st and 2nd program

Started by shankle, December 02, 2012, 09:24:41 AM

Previous topic - Next topic

shankle

In my 1st GoAms program the code below compiled/linked with no errors
and the program executed correctly. Code is in Winmain
   mov   rax,offset WndProc   
   mov   Q[wc.lpfnWndProc],rax   

In the 2nd program this same code is wanting [] around something....
Can't get a clean compile????
Used the label WndProc in both programs.
Feel  like an idiot but what the heck.....

dedndave

mov   rax,offset WndProc

"offset" is a MASM thing
in GoAsm, you can get the address of a label simply with...
mov   rax,WndProc

this is one of the biggest differences between MASM and GoAsm syntax
("frame" is probably the biggest   :P )

i might add that, because it is a code label, MASM does not need "offset", either

wjr

GoAsm usually specifies which line number is at fault. In this case I believe it is the first line. The error message most likely was "Use square brackets to address memory, ADDR or OFFSET to get address". This is one of the differences between GoAsm and MASM, but it is the other way around, MASM allows the second code snip above, GoAsm requires the first.

Given that you are using OFFSET, I suspect that rax is the problem since you have not specifed either /x86 or /x64 on the command line (in which case rax is not recognized as a register, but taken as a label, which gives the error since either [rax] or ADDR rax would be required in that case).

shankle

Thank you very much WJR.
I forgot to change the JCL in the GoAsm line to /x64.