flat assembler
Message board for the users of flat assembler.

Index > Main > question about "struct"

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Code:
struct toto
v1 dd ?
ends

mov eax,mystruct + 4          ;a) does compile
mov eax,mystruct.mylocal        ;b) does not compile

mystruct toto

.mylocal:

dw1 dd ?

;Why "b" does not compile ?
;mystruct is not a global label ?
;and if "mystruct" is not a global label, then why "a" does compile ?

    

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 25 Oct 2010, 21:56
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17667
Location: In your JS exploiting you and your system
revolution
struct != struc

Use the tools provided by fasm to see what struct does: "PREPSRC.INC"
Post 25 Oct 2010, 23:39
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

PREPSRC.INC ?
thank revolution you for your reply,
but that does not help me much.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Oct 2010, 00:00
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17667
Location: In your JS exploiting you and your system
revolution
In the "TOOLS" folder.
Post 26 Oct 2010, 00:01
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

yes, I know, I've seen.
and what do I do with this file?
or it is already too late and my brain is sleeping ...
it's possible too!
Confused

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Oct 2010, 00:05
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17667
Location: In your JS exploiting you and your system
revolution
Go to the sub folder TOOLS\WIN32 and assemble "PREPSRC.ASM"
Post 26 Oct 2010, 00:12
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Actually, it it not really related to "struct" being not the same as "struc", since with "struc" exactly the same happens:
Code:
struc toto
{
 .v1 dd ?
}

mov eax,mystruct + 4            ; does compile
mov eax,mystruct.mylocal        ; does not compile

mystruct toto

.mylocal:

dw1 dd ?    
It is because "mystruct.v1" is a "global" label from the point of view of NASM-style locals - therefore ".mylocal" can be accessed as "mystruct.v1.mylocal". These features don't mix well.
Post 26 Oct 2010, 07:40
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Code:
struct toto
v1 dd ?
ends

mov eax,mystruct.v1.mylocal

mystruct toto

.mylocal:
    
yes indeed, this above compiles without problem.
"mystruct.v1" is a "global" label .... ok, understood Tomasz.
(dito for "struct" AND for "struc")
this is very important for the future behavior of wink.
thank you for your explanation.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 26 Oct 2010, 08:12
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.