Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: Brian Alvarez on May 14, 2019, 10:31:24 PM

Title: Linker found unidentified names
Post by: Brian Alvarez on May 14, 2019, 10:31:24 PM
 Hello Charles, sorry to bother, i just want to help Oxygen to get better. :)

In 32bit mode, this code compiles and works fine, but
try this in 64 bit mode and it fails at compilation.

I have this TYPE:

Code: [Select]
TYPE THREADVAR_PTR
  QUAD   addr
  = 
  DWORD  upper
  DWORD  lower
END TYPE

When i define a THREADVAR_PTR variable like this:

Code: [Select]
THREADVAR_PTR tp
And then use it like this:

Code: [Select]
tp.addr = getmemory(sizeof(dtype))
I get this when i try to compile:

Code: [Select]
Linker found unidentified names:
364 fildqword "main source

When i edit the TYPE like this:

Code: [Select]
TYPE THREADVAR_PTR
  SYS   addr
  DWORD dummy ' add some extra dummy bytes in case of 32 bit.
  = 
  DWORD  upper
  DWORD  lower
END TYPE

Everything compiles fine.

 I think it should be an easy fix, right?
Title: Re: Linker found unidentified names
Post by: Charles Pegge on May 14, 2019, 11:08:27 PM
Thanks Brian,

I will investigate.


You won't need the dummy, and lower comes before upper in little-endian x86:

Code: [Select]
TYPE THREADVAR_PTR
  SYS   addr
  =
  DWORD  lower
  DWORD  upper
Title: Re: Linker found unidentified names
Post by: Brian Alvarez on May 15, 2019, 01:40:22 AM
Cool, Thanks Charles. I thought that since SYS is 32 bits in x32 mode, the second dword would overflow the type.
Its good to know it wont...

So, the bigger blocks defines the size of the UDT, right?
Title: Re: Linker found unidentified names
Post by: Charles Pegge on May 15, 2019, 02:18:00 AM
Yes, unions are always padded out to the max.