flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > minor bug? |
Author |
|
asmfan 31 Oct 2006, 21:15
Just macro compillation bug?
Code: include 'win32wx.inc' entry start start: xor ebx,ebx push MB_OK OR MB_ICONINFORMATION push _capt push _text push ebx call [MessageBox] push ebx call [ExitProcess] _capt DU 'This is a caption',0 _text DU 'This is a text inside',0 data import library kernel32,'kernel32.dll',\ user32,'user32.dll' ;import kernel32,\ ; ExitProcess,'ExitProcess' ;import user32,\ ; MessageBox,'MessageBoxW' end data
_________________ Any offers? |
|||||||||||
31 Oct 2006, 21:15 |
|
asmfan 01 Nov 2006, 07:36
this bug is with 1.67.14 FASM.
Remy study calling conventions (stdcall) and take a look at extended includes to know why are they called so. |
|||
01 Nov 2006, 07:36 |
|
Reverend 01 Nov 2006, 20:50
Remy Vincent, the convention of not changing ebx, edi, esi is a main assumption in Windows Programming. That's how compilers generate code, and that's how Windows kernel behaves even internally. It's the basis, and so you can only trust it. Also, I don't know any examples where ebx, edi or esi were changed after some call to Windows API.
|
|||
01 Nov 2006, 20:50 |
|
asmfan 01 Nov 2006, 21:15
I still haven't got an answer
Code: ;format PE GUI 4.0 include 'win32wx.inc' ;entry start start: xor ebx,ebx push MB_OK OR MB_ICONINFORMATION push _capt push _text push ebx call [MessageBox] push ebx call [ExitProcess] _capt DU 'This is a caption',0 _text DU 'This is a text inside',0 data import library kernel32,'kernel32.dll',\ user32,'user32.dll' include 'api\kernel32.inc' include 'api\user32.inc' ;import kernel32,\ ; ExitProcess,'ExitProcess' ;import user32,\ ; MessageBox,'MessageBoxW' end data extended includes have such declorations inside: Code: macro import lib,[functions] { common macro import_#lib \{ import lib,functions \} } include 'api/kernel32.inc' include 'api/user32.inc' include 'api/gdi32.inc' include 'api/advapi32.inc' include 'api/comctl32.inc' include 'api/comdlg32.inc' include 'api/shell32.inc' include 'api/wsock32.inc' consequently i don't have to declare "import". If i don't, i get "Undefined symbol", but if i do i get "symbol already defined"! It's too bad to be truth... _________________ Any offers? |
|||
01 Nov 2006, 21:15 |
|
Mr_Silent 02 Nov 2006, 03:54
Code: ;format PE GUI 4.0 include 'win32wx.inc' entry start start: xor ebx,ebx push MB_OK OR MB_ICONINFORMATION push _capt push _text push ebx call [MessageBox] push ebx call [ExitProcess] _capt DU 'This is a caption',0 _text DU 'This is a text inside',0 data import library kernel32,'kernel32.dll',\ user32,'user32.dll' ;import kernel32,\ ; ExitProcess,'ExitProcess' import_kernel32 ;import user32,\ ; MessageBox,'MessageBoxW' import_user32 end data As far as I can understand, win32wx.inc was designed to use use with .data, .code, .end . Since you use it in your own way - hence the problems |
|||
02 Nov 2006, 03:54 |
|
asmfan 02 Nov 2006, 06:50
but what if need to do a parameter-count checking while invoking? i just add 'xp' to basic header do the checking and then erase it back to simplyer one include. and as i remember i did it before.
|
|||
02 Nov 2006, 06:50 |
|
Mr_Silent 02 Nov 2006, 08:14
asmfan wrote: but what if need to do a parameter-count checking while invoking? i just add 'xp' to basic header do the checking and then erase it back to simplyer one include. and as i remember i did it before. Your original code works with older version of import macro. Since this, it doesn't. Ask Tomasz about his opinion of this problem. About ebx: (from here) Iczelion wrote:
|
|||
02 Nov 2006, 08:14 |
|
Tomasz Grysztar 02 Nov 2006, 20:52
Mr_Silent wrote: Your original code works with older version of import macro. Since this, it doesn't. Ask Tomasz about his opinion of this problem. Yeah, those changes are still being developed, so you may expect such problems to be gradually resolved. This is a process that I began after a brief discussion with vid about allowing both "A" and "W" functions to be accessed with standard imports (the discussion took place at the 1st fasm's meeting in Kraków), and I decided to introduce those changes in a way that would break backward-compatibility in as few places as possible. As you noticed, it still causes some problems, but I think I will have them fixed soon. |
|||
02 Nov 2006, 20:52 |
|
asmfan 02 Nov 2006, 22:16
Thx! now i'll sleep well looking forward to see ALLMIGHTY FASM $)
Fasm is great as you are Tomasz!!! |
|||
02 Nov 2006, 22:16 |
|
vid 02 Nov 2006, 22:40
|
|||
02 Nov 2006, 22:40 |
|
Tomasz Grysztar 03 Nov 2006, 19:29
Please try the updated fasm for Windows package, I've corrected the extended headers to take into account the latest changes in the import packages.
|
|||
03 Nov 2006, 19:29 |
|
asmfan 03 Nov 2006, 21:39
Works nice now, but i still don't understand what for are those strings in extended headers
Code: include 'api/kernel32.inc' include 'api/user32.inc' include 'api/gdi32.inc' include 'api/advapi32.inc' include 'api/comctl32.inc' include 'api/comdlg32.inc' include 'api/shell32.inc' include 'api/wsock32.inc' if we have to declare them in import in asm file nevertheless? _________________ Any offers? |
|||
03 Nov 2006, 21:39 |
|
Tomasz Grysztar 03 Nov 2006, 21:54
They get used only if you use the ".end" macro.
|
|||
03 Nov 2006, 21:54 |
|
asmfan 04 Nov 2006, 21:16
I got it Tomasz, but i don't understand why it is so difficult? While it can be done, IMHO, much easier
|
|||
04 Nov 2006, 21:16 |
|
asmfan 04 Nov 2006, 21:29
don't know if it can substitute your macro correctly, but could you take a look?
Just to compare them both - original and this one
_________________ Any offers? |
|||||||||||
04 Nov 2006, 21:29 |
|
asmfan 04 Nov 2006, 23:38
also not to start new thread there is a different behavior of code below
Code: tmp1 rb 0 tmp2 db 0 dup (?) the second variant fail to assemble. I faced this problem while doing my custom aligning macro |
|||
04 Nov 2006, 23:38 |
|
Tomasz Grysztar 05 Nov 2006, 01:30
asmfan wrote: I got it Tomasz, but i don't understand why it is so difficult? While it can be done, IMHO, much easier This is because the assumption is that it should work even if you include WIN32AX.INC without having those includes in your INCLUDE environment variable (like, by providing the full path, or using %fasminc%, as some of the people still seem to prefer). [quote="asmfan"]also not to start new thread there is a (...)[/code] You should have started a new thread - this is a different thing (and this time more appropriate for "Compiler Internals" forum, while current thread I had to move to "Macroinstructions"). |
|||
05 Nov 2006, 01:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.