flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Main > structures... | 
| Author | 
 | 
| cod3b453 07 Dec 2009, 23:20 string.size is not a defined symbol for struc, however if you do:
 Code: str2 string 'some',0x0A,'text' then actually the symbol str2.size is defined: Code: mov dword [str2.size], str2-str0-5 | |||
|  07 Dec 2009, 23:20 | 
 | 
| kohlrak 07 Dec 2009, 23:41 str2 is actually an rb, so that doesn't work.
 I know i've done something like this before when doing windows programming, but for some reason i can't get it to work anymore. I can even find posts here where suggestions like this are made, so i'm guessing it's something special one of the windows includes add, but i can't find which include it is... | |||
|  07 Dec 2009, 23:41 | 
 | 
| cod3b453 08 Dec 2009, 01:01 Well you can do string.size with struct:
 Code: struct string size dd ? ; not sure how to handle this bit though... ends | |||
|  08 Dec 2009, 01:01 | 
 | 
| kohlrak 08 Dec 2009, 01:14 I could've sworn that struc itself was rewritten along with struct. Oh well, point made... I'll either have to write a wrapper struc to rewrite struct or support it in my struc. Thanks for your help. | |||
|  08 Dec 2009, 01:14 | 
 | 
| edfed 08 Dec 2009, 02:40 | |||
|  08 Dec 2009, 02:40 | 
 | 
| kohlrak 08 Dec 2009, 03:08 Related problems, but not quite the same one. My main issue is that I have to do this:
 Code: meow.size = 0 meow.text = 4 struc meow param { .size dd 0 forward .text db param } mov eax, [eax+meow.size] instead of: Code: struc meow param { .size dd 0 forward .text db param } mov eax, [eax+meow.size] because otherwise the code won't work. I could've sworn i was able to do the second code when i did windows programming, but perhaps i was wrong. | |||
|  08 Dec 2009, 03:08 | 
 | 
| Borsuc 08 Dec 2009, 04:13 struc doesn't DECLARE anything, it just DEFINES a structure.
 Code: struc meow param { .size dd 0 forward .text db param } declared meow 4 mov eax, [eax+declared.size]   (just like a macro) _________________ Previously known as The_Grey_Beast | |||
|  08 Dec 2009, 04:13 | 
 | 
| kohlrak 08 Dec 2009, 19:12 Indeed, i just thought that since i was able to do it (perhaps i was using struct somehow before) before, it was just a fancy feature of a structure. | |||
|  08 Dec 2009, 19:12 | 
 | 
| edfed 08 Dec 2009, 21:28 from tha fasm manual, i read that:
 Code: struct point x,y { dd x,y } p1 point 1,2 mov eax,[p1.x] mov ebx,[p1.y] struct is just an addressing method you can write a macro that use the structure. | |||
|  08 Dec 2009, 21:28 | 
 | 
| Borsuc 09 Dec 2009, 20:58 struct is not the same as struc | |||
|  09 Dec 2009, 20:58 | 
 | 
| edfed 10 Dec 2009, 00:23 erf. sorry. struc point x,y | |||
|  10 Dec 2009, 00:23 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.