NASM Forum > Other Discussion
Need some help with STRUC/ENDSTRUC
dapleal:
Hi. I´ve been trying Nasm 2.10 and Nasmx-1.0 for win32 OOP, and it´s been quite an interesting learning experience. I'm having some trouble with STRUC/ENDSTRUC and ISTRUC/IEND in Nasm 2.1. (I´m using ALINK). Say, If I declare two STRUC/ENDSTRUC definitions [struc A/endstruc, struc B/endstruc ], the compiler displays an error msg pointing to the first ENDSTRUC. The same happens with the ISTRUC/IEND at [segment .data]. It seems to me that the compiler does not allow more than one ENDSTRUC or IEND within the code. Is that right ? Cause Nasm documentation is not clear enough on that subject, and if I delete the error lines, it doesn´t work either. Any ideas ? Could it be a linker problem ?
Keith Kanios:
The following is a simple (but not meant to be directly executed) example that successfully assembles to coff/win32.
--- Code: ---[BITS 32]
struc A
.test RESD 1
endstruc
struc B
.test RESD 1
endstruc
[section .text]
lea ebx,[iA]
mov eax,DWORD[ebx+A.test]
[section .data]
iA:
istruc A
at A.test, DD 1
iend
iB:
istruc B
at B.test, DD 1
iend
--- End code ---
If you get any errors with the above example, it is entirely ALINK.
dapleal:
OK. It works. I've just had to type an entry point (..start:) underneth the [section .text] line.
I'm compiling like this: (as usuall, but not used STRUC/ENDSTRUC till now)
nasm -f obj (name).asm
alink (name).obj -o PE -subsys windows
It generates the .exe file, but still displays the following error msg:
"Relocs 0:Warning 32 bit offset in 16 bit field"
That´s what´s been killing me all day.
Any suggestion of another free linker just for testing ?
Thanks for the help.
Arq:
You can give a chance to Jeremy Gordon's neat linker GoLink (http://www.godevtool.com/) and say goodbye to imports libs mess also you can try out Polink from PellesC or the classic Microsoft link.exe.
Regards.
Keith Kanios:
+1 for GoLink. It is/was bundled with NASMX. IIRC, NASM32/NASMX started with ALINK, then moved to PoLink due to shortcomings with ALINK, and finally to GoLink for further quality/feature considerations.
Navigation
[0] Message Index
[#] Next page
Go to full version