flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Typedef and sizeof

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 27 May 2010, 08:49
Hello guys,

I'm using the typedef macro as presented by Tomasz but when I apply "sizeof.MyTypedef", assembler gives error. Example:

Code:
macro typedef type,base
{ struc type [v] \{ \common . base v \} 
  macro type [v] \{ \common base v \} }


struct MyStruct

    field1     dd      ?
    filed2     dd      ?

ends

typedef MyStructTypedef, MyStruct

a  MyStruct <>
b  MyStructTypedef <>


mov eax, sizeof.MyStruct          ; OK
mov eax, sizeof.MyStructTypedef   ; error "Undefined symbol"      


Is it possible to use sizeof in typedef?

Thanks!
Post 27 May 2010, 08:49
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 27 May 2010, 09:29
alorent,

Insert «sizeof.#type = sizeof.#base» at the end of typedef macro.

You must know your tools; struct macro seems complex, but it's not.
Post 27 May 2010, 09:29
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 27 May 2010, 10:29
Thanks again baldr!!! Amazing!!! Very Happy
Post 27 May 2010, 10:29
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.