flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > invoke macro extending

Author
Thread Post new topic Reply to topic
IceStudent



Joined: 19 Dec 2003
Posts: 60
Location: Ukraine
IceStudent
Hi!

I improved invoke macro for allowing calls all functions directly (without selecting ccall/stdcall/cinvoke calls for each function).

Now you can use it simpler:
Code:
... std header
include 'invokeex.inc' ; extended invoke

; mark external cdecl functions as ccall
__cdecl printf,wsprintf

; or you can mark local functions, e.g
__cdecl test4

; but you can't mark as cdecl functions, that are declared as stdcall
;__cdecl test5

__start:
        ; calling functions only by invoke
        invoke test1,1,2        ; stdcall
        invoke test2            ; stdcall
        invoke test3,1,4        ; cdecl
        invoke test4,5          ; marked as cdecl
        invoke test5,5          ; forced stdcall
        invoke wsprintf,buf,fmt,eax     ; imported, marked as cdecl

        invoke ExitProcess,0 ; imported, stdcall by default

; stdcall by default
proc test1 a,b
        local var dd ?
        
        mov             eax,[a]
        add             eax,[b]
        mov             [var],eax
        
        local var2 dd ?
        mov             [var2],eax
        
        ret
endp

proc test2
        
        nop
        ret
endp

proc test3 c a,b
        
        mov             eax,[a]
        add             eax,[b]
        ret
endp

proc test6 stdcall a,b

        mov             eax,[a]
        sub             eax,[b]
        not             eax
        ret
endp

; setted as stdcall proc by MARKCPROC
proc test4 a
        
        mov             eax,[a]
        xor             eax,0xADADADAD
        invoke test6,eax,0
        ret
endp

; declared as stdcall
proc test5 stdcall a
        
        ret
endp    


Description: extended invoke implementation
Download
Filename: invokeex.inc
Filesize: 1.97 KB
Downloaded: 95 Time(s)

Post 08 Oct 2006, 12:44
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-2020, Tomasz Grysztar.

Powered by rwasa.