flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Need Help with struct/struc |
Author |
|
LocoDelAssembly 10 Aug 2010, 05:06
I'm not sure why the error is detected so late that it ends catched up by something unrelated, it seems that there has to be at least one valid data instruction for it to work properly. The problem is that you used "DD" instead of "dd" inside struct. If you change only one of those DDs to dd, you'll see an error message coming from "ends".
Probably this needs fixing, so I'm moving it to Compilers Internals (it is not an error with fasm itself though, only the struct macro is wrong). |
|||
10 Aug 2010, 05:06 |
|
bitshifter 10 Aug 2010, 18:07
I think you would have to extend macro to accept uppercase also...
INCLUDE\MACRO\STRUCT.INC Code: ... struc dd [val] \{ \common define field@struct .,dd,<val> fields@struct equ fields@struct,field@struct \} struc DD [val] \{ \common define field@struct .,dd,<val> fields@struct equ fields@struct,field@struct \} ... I am not sure if this is the correct way to fix it though? |
|||
10 Aug 2010, 18:07 |
|
LocoDelAssembly 10 Aug 2010, 18:28
bitshifter,
I think it is a good idea to have all possible combinations (dd, dD, Dd and DD), but that wouldn't fix the problem, the following code is not triggering the error at ends: Code: include 'win32ax.inc' struct TST xor eax, eax ends Code: include 'win32ax.inc' struct TST field db ? ; Only difference with previous code. xor eax, eax ends |
|||
10 Aug 2010, 18:28 |
|
bitshifter 10 Aug 2010, 19:04
But that is trying to break it...
I think instructions should not be allowed in struct. But for OOP you should be able to define function pointers... Code: include 'win32ax.inc' struct TST field db ? pfn dd do_stuff ends section '.code' code readable executable do_stuff: xor eax,eax section '.data' data readable writeable tstInstance TST |
|||
10 Aug 2010, 19:04 |
|
LocoDelAssembly 10 Aug 2010, 19:24
Quote:
I completely agree with that, and that is the reason for what I want the error to be ALWAYS detected, not only when at least one field definition was valid. My second code fails with an error message generated by "ends" macro saying "Error: definition of TST contains illegal instructions.", I want that error to appear in my first code too, but currently it doesn't. |
|||
10 Aug 2010, 19:24 |
|
Tomasz Grysztar 31 Aug 2010, 09:03
LocoDelAssembly wrote: [My second code fails with an error message generated by "ends" macro saying "Error: definition of TST contains illegal instructions.", I want that error to appear in my first code too, but currently it doesn't. |
|||
31 Aug 2010, 09:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.