The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: shankle on December 02, 2012, 09:24:41 AM

Title: errors between 1st and 2nd program
Post by: shankle on December 02, 2012, 09:24:41 AM
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.....
Title: Re: errors between 1st and 2nd program
Post by: dedndave on December 02, 2012, 10:05:46 AM
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
Title: Re: errors between 1st and 2nd program
Post by: wjr on December 03, 2012, 09:17:45 AM
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).
Title: Re: errors between 1st and 2nd program
Post by: shankle on December 03, 2012, 01:06:01 PM
Thank you very much WJR.
I forgot to change the JCL in the GoAsm line to /x64.