flat assembler
Message board for the users of flat assembler.
Index
> Windows > dll call suggestion Goto page 1, 2 Next |
Author |
|
karl 26 Sep 2006, 10:12
oh, and i guess this could be done with macros but again, it's not very clean...
|
|||
26 Sep 2006, 10:12 |
|
revolution 26 Sep 2006, 12:19
Quote: i know it doesn't add much to the .exe, but i'm a perfectionist. |
|||
26 Sep 2006, 12:19 |
|
karl 26 Sep 2006, 12:50
the import macros are really complicated. and either you have to have them in your source file, which is ugly, or you have to include it, and thus have more than one source. one source, one output is most preferable, i think.
|
|||
26 Sep 2006, 12:50 |
|
karl 26 Sep 2006, 12:55
oh, and with macros the imports in the source stay even if they don't end up in the .exe. so if you have a huge project you could have 20 imports written in your source that aren't ever used.
plus, everytime you want to call an import you have to check if you've imported it, and then if not write it to 2 places in your import section. why not make the assembler do this? it cleans up your code. |
|||
26 Sep 2006, 12:55 |
|
revolution 26 Sep 2006, 13:03
Quote: call[&KERNEL32.GetWindowEx] |
|||
26 Sep 2006, 13:03 |
|
shoorick 26 Sep 2006, 13:32
check scan utility by Vortex
_________________ UNICODE forever! |
|||
26 Sep 2006, 13:32 |
|
karl 26 Sep 2006, 13:37
yes i agree, the macros and include system work well for modular programming, which is important for multi-developer projects. fasm tries to be a general tool and i'm only working on single-developer Windows systems. i think i might try make an assembler specific for my needs. based on fasm of course , the cleanest programming system i've ever seen.
|
|||
26 Sep 2006, 13:37 |
|
karl 26 Sep 2006, 13:46
shoorick: interesting, thanks
|
|||
26 Sep 2006, 13:46 |
|
okasvi 27 Sep 2006, 16:07
karl, you should read "Design Principles, or Why fasm Is Different" and then have a look at this topic: http://board.flatassembler.net/topic.php?t=5514
|
|||
27 Sep 2006, 16:07 |
|
vid 27 Sep 2006, 18:17
no problem... just learn how PE imports look and import without macros:
Code: dd thunk1, 0, 0, name1, thunk1 dd thunk2, 0, 0, name2, thunk2 dd 0,0,0,0,0 name1 db "KERNEL32.DLL" align 4 thunk1: ExitProcess dd imp_ExitProcess ;import by name MessageBox dd imp_MessageBox ;import by name dd 0 ;end of imports from KERNEL32 imp_ExitProcess dw 0 db "ExitProcess" imp_MessageBox dw 0 db "MessageMoxA" name2 db "MyDLL.DLL" align 4 thunk2: dd 80000001h ;import by ordinal #1 dd 80000100h ;import by ordinal #0x100 dd 0 ;end of imports from MyDLL |
|||
27 Sep 2006, 18:17 |
|
karl 03 Oct 2006, 10:52
... thanks okasvi. i like tomasz's syntax better. but still, want no macros
vid: ya, that's the method i've been using. but it sucks cause sometimes i import what i don't need. cause i build up from previous projects, end up importing lots.... |
|||
03 Oct 2006, 10:52 |
|
vid 03 Oct 2006, 11:13
if you want to go without macros, then you must use way i described and enclose things which "if used MessageBox" etc...
|
|||
03 Oct 2006, 11:13 |
|
karl 03 Oct 2006, 13:50
hmmm ya didn't think about that. thanks
|
|||
03 Oct 2006, 13:50 |
|
Fungos Bauux 03 Oct 2006, 17:10
I aways put all imports at my projects. Even if I dont use any. :O
|
|||
03 Oct 2006, 17:10 |
|
shoorick 04 Oct 2006, 14:51
full imports slow down compilation sufficiently. also, full imports do not let you use ansi and unicode functions at once, if you need - Vortex' scan cover both problems.
|
|||
04 Oct 2006, 14:51 |
|
Tomasz Grysztar 04 Oct 2006, 18:23
shoorick wrote: full imports do not let you use ansi and unicode functions at once, if you need This is no longer true with latest packages. |
|||
04 Oct 2006, 18:23 |
|
OzzY 04 Oct 2006, 20:28
I'm using a nice way to speed-up my development cycle: compile, run, test, fix /write code, compile...
With the way I'll show here you automate the building of import section and resource section. What you'll need: * FASMW * ResEd * Win32API Documentation (Not really necessary, but helps a lot while coding) * vbVeryBeginner's RC->FASM resource macros converter ( http://board.flatassembler.net/topic.php?t=5795) * Vortex's Scan Utility ( http://www.vortex.masmcode.com/files/scan345.zip ) * MS-DOS command prompt Let's begin. 1) Open up ResEd, and design a Dialog called dlgmain, a button called btnquit. Set the title and options as you like. Save as RSRC.RC. You now have the basic look of your application. 2) Open up FASMW, and type this code: Code: include '%fasminc%\win32a.inc' include '%fasminc%\macro\if.inc' format PE GUI 4.0 entry main section '.code' code readable executable main: invoke DialogBoxParam,0,dlgmain,0,dlgproc,0 invoke ExitProcess,0 proc dlgproc hwnd,msg,wp,lp .if [msg]=WM_CLOSE invoke ExitProcess,0 .elseif [msg]=WM_COMMAND .if [wp]=btnquit invoke ExitProcess,0 .endif .endif xor eax,eax ret endp include 'rsrc.inc' include 'test.imp' Save as TEST.ASM. open up MS-DOS prompt and cd to your project folder, and type: Quote:
You should now have test.exe! Execute it and your dialog pops-up! Now every time you modify rsrc.rc or test.asm just run "build" again. And your resource section and import section will always be up-to-date. This is a very good way to keep your code modular and clean. You can easily modify your resource file and asm file without having to worry about imports and resources messing up with your source code. And you don't even need a resource compiler or to type the imports manually. Enjoy!! I think this is a very confortable programming environment. Thanks to Tomasz, vbVeryBeginner and Vortex for the amazing tools! |
|||
04 Oct 2006, 20:28 |
|
vid 05 Oct 2006, 06:49
Tomasz: if you changed headers already, make an announcement in Windows section pls
|
|||
05 Oct 2006, 06:49 |
|
karl 05 Oct 2006, 11:07
thanks very interesting ozzy, thanks
|
|||
05 Oct 2006, 11:07 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.