NASM Forum > Other Discussion

Need some help with STRUC/ENDSTRUC

<< < (2/2)

Frank Kotler:

--- Quote ---It generates the .exe file, but still displays the following error msg:

     "Relocs 0:Warning 32 bit offset in 16 bit field"

--- End quote ---

"-f obj" is by default a 16-bit format. As you know(?), it is necessary to declare each section/segment "use32". It might not hurt to put "bits 32" at the top of the file, just to "catch" anything that's not in a segment. Although "-f obj" and Alink may be considered "obsolete", it "should" still work fine and I'm not aware of any disadvantage.

Best,
Frank

dapleal:
Hi. Just to tell I realized what I was doing wrong with “ISTRUC/IEND”.  Sorry for the trouble, it works just like you said.

On page 70 of the NASMDOC.PDF file (NASM 2.10 documentation)  there are two given examples on “STRUCTURE / ENDSTRUC”. While on the following page there´s only one given on “ISTRUC / IEND”.

I would dare to suggest you guys may also include the corresponding “ISTRUC/IEND” example to the other one.  It may save hours of frustration to other beginners like me. That is:

struc mytype
 .long: resd 1
 .word: resw 1
 .byte: resb 1
 .str:  resb 32
endstruc      ; (page 70)

mystruc:
istruc mytype
 at mytype.long, dd 123456
 at mytype.word, dw 1024
 at mytype.byte, db ’x’
 at mytype.str,  db ’hello, world’, 13, 10, 0
iend
(there is no such example on page 71 within the .pdf doc file)

What I was doing wrong was:
mystruc:
istruc mytype
 at .long, dd 123456
 at .word, dw 1024
 at .byte, db ’x’
 at .str,  db ’hello, world’, 13, 10, 0
iend

Thanks for the help. Congratulations for the great job with NASM and NASMX.

Navigation

[0] Message Index

[*] Previous page

Go to full version