News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Declaring a variable

Started by angvelem, November 12, 2011, 07:22:58 PM

Previous topic - Next topic

angvelem

We have the following (MASM):

  TRACE_MAX    EQU 21

  TTrace STRUCT
    Coo        BASS_3DVECTOR <>
    Alpha    GLfloat ?
  TTrace ends

  TShapeTrace STRUCT
    Trace    TTrace TRACE_MAX dup (<>)
  TShapeTrace ends

.data?
  Shaper    TShapeTrace   701 dup (<>)  ; error


I can not understand how to properly describe the variable Shaper. Keep getting a message about an incorrect initialization of the structure. What is correct? I looked through all the sources for MASM, there is nothing similar.

jj2007

Try this:
include \masm32\include\masm32rt.inc

  TRACE_MAX    EQU 21
BASS_3DVECTOR STRUCT
x dd ?
y dd ?
z dd ?
BASS_3DVECTOR ENDS

  TTrace STRUCT
    Coo       dd ? ; BASS_3DVECTOR <>
    Alpha    dd ? ;GLfloat ?
  TTrace ends

  TShapeTrace STRUCT
    Trace    TTrace TRACE_MAX dup (<>)
  TShapeTrace ends

.data?
  Shaper    TShapeTrace   701 dup (<>)  ; error
.code
AppName db "Masm32:", 0

start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit

end start

angvelem

The same mistake:

...
.data?
  Shaper TShapeTrace   701 dup (<>)


error A2177: nested structure improperly initialized

jj2007

Full example, but it will work only with JWasm. Don't ask me why ::)
include \masm32\include\masm32rt.inc

  TRACE_MAX    EQU 21
BASS_3DVECTOR STRUCT
x dd ?
y dd ?
z dd ?
BASS_3DVECTOR ENDS

  TTrace STRUCT
    Coo       BASS_3DVECTOR <>
    Alpha    REAL4 ? ; GLfloat ?
  TTrace ends

  TShapeTrace STRUCT
    Trace    TTrace TRACE_MAX dup (<>)
  TShapeTrace ends

.data?
  Shaper    TShapeTrace   701 dup (<>)  ; error
.code
AppName db "Masm32:", 0

start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit

end start

angvelem


qWord

This a nasty bug!
Using a dummy structure may helps you:
  s STRUCT
    Trace    TTrace TRACE_MAX dup ({})
  s ends

  TShapeTrace STRUCT
    Trace    s <>
  TShapeTrace ends
...
Shaper    TShapeTrace   701 dup ({})
FPU in a trice: SmplMath
It's that simple!

angvelem


jj2007

Quote from: angvelem on November 12, 2011, 09:13:47 PM
Alas, I only have MASM.

http://www.japheth.de/JWasm.html#jwdownload - and you only need to replace \masm32\bin\ml.exe with jwasm.exe
Keep a copy of ml.exe, though - there are rare cases where Jwasm chokes over something.

qWord, is that a known Masm bug?

angvelem

I have already found their website and downloaded the JWASM.

angvelem

Quote from: jj2007 on November 12, 2011, 11:23:39 PM
http://www.japheth.de/JWasm.html#jwdownload - and you only need to replace \masm32\bin\ml.exe with jwasm.exe
Keep a copy of ml.exe, though - there are rare cases where Jwasm chokes over something.

Very bad compiler, include files from libraries BASS does not understand

jj2007

Quote from: angvelem on November 16, 2011, 07:16:20 PM
Very bad compiler

It's called assembler, not compiler. And the problem might well be in your include files.

angvelem

It is you are talking to myself? Very noticeable on your behavior. Not respecting other, you do not respect yourself.

Removed the offending message? It means you are not quite yet lost man

angvelem

Include file is not my, he out of the library BASS.

qWord

Quote from: jj2007 on November 12, 2011, 11:23:39 PM

qWord, is that a known Masm bug?
Well, I know this error  :bg
IIRC there was also a discussion here ...
FPU in a trice: SmplMath
It's that simple!