flat assembler
Message board for the users of flat assembler.

Index > Windows > yes another sizeof error!

Author
Thread Post new topic Reply to topic
Kenny80



Joined: 08 May 2005
Posts: 22
Kenny80 19 Jul 2006, 19:28
following line gets refused and i have no clue to how fix it!

invoke SendDlgItemMessage, [hhWnd], IDC_NAME, EM_SETLIMITTEXT, .sizeof.sName-1, 0

fasm don't like ".sizeof.sName-1" since it tries to convert it to "push .sizeof.sName-1" and all i want is like in masm where it replace ".sizeof.sName-1" with "30h-1=29h" since sName in my code is declared as 30h big "sName db 30h dup (?)", so should be converted in code to "push 29h", but how do i make it work? i don't want update all places with in source everytime sName's size change, instead just change declaration i made!
Post 19 Jul 2006, 19:28
View user's profile Send private message Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi 19 Jul 2006, 19:46
1. It's 'sizeof.*'
2. I think it does _not_ work for '<label> db/dw/dd <size> dup (?)'
but read this too: http://flatassembler.net/docs.php?article=manual#2.3.4
Post 19 Jul 2006, 19:46
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Jul 2006, 21:56
"sizeof.*" is just normal constant that gets defined along with "struc" definition. you can define size yourself, like:
Code:
sName db 30h dup (?)
sizeof.sName = $-sName    


or more fasm-y way:

Code:
sName rb 30h
sizeof.sName = $-sName    


and if you want to know size of every such-way-defined string, or buffer, i suggest automatizing sizeof variable declaration with macro

Code:
struc buffer size {
. rb size
sizeof.#. = $ - .
}
MyString buffer 120    


can be extended to work also for initialized data...

btw: how did you come to "another sizeof error"?
Post 19 Jul 2006, 21:56
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kenny80



Joined: 08 May 2005
Posts: 22
Kenny80 20 Jul 2006, 06:52
Wonderful, thx for all answers!

vid wrote:
"btw: how did you come to "another sizeof error"?


Just naming thing, i searched first for sizeof post but didn't find what i needed so instead of posting "i got sizeof error" and get reply "search forum, morron" ;D , instead i added "another" Wink
Post 20 Jul 2006, 06:52
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Jul 2006, 09:05
well, it suggest there was some previous.... and it suggest error is on fasm's side Wink
Post 20 Jul 2006, 09:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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.