Author Topic: ISTRUC Error: error: "non-constant argument supplied to TIMES"  (Read 10675 times)

Offline sergioortega1

  • New Member
  • Posts: 1
This is part of my code:

SECTION .data
   Head: ISTRUC Node
      AT Node.Value, dd 0
      AT Node.NextPtr, dd Second
      AT Node.PrevPtr, dd Tail
   IEND

   Second: ISTRUC Node
      AT Node.Value, dd 0
      AT Node.NextPtr, dd Tail
      AT Node.PrevPtr, dd Head
   IEND
   
   Tail: ISTRUC Node
      AT Node.Value, dd 0
      AT Node.NextPtr, dd Head
      AT Node.PrevPtr, dd Second
   IEND

I am getting the error "non-constant argument supplied to TIMES" for each line that uses "IEND".
Any help would be greatly appreciated.

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: ISTRUC Error: error: "non-constant argument supplied to TIMES"
« Reply #1 on: April 24, 2019, 02:21:59 PM »
From NASM doc:

Quote
The function of the AT macro is to make use of the TIMES prefix to advance the assembly position to the correct point for the specified structure field, and then to declare the specified data. Therefore the structure fields must be declared in the same order as they were specified in the structure definition.

And, so, this works:

Code: [Select]
bits 64
default rel

section .data

struc mystruc
.value: resd  1
.next:  resq  1
.prev:  resq  1
endstruc

p:  dq  0

mylist:
  istruc mystruc
    at mystruc.value, dd 1
    at mystruc.next,  dq p
    at mystruc.prev,  dq p
  iend