flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > problem with double in invoke macro

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 11 Feb 2007, 14:49
seems there are bug in calling convention with double macro:

Code:
format pe gui 4.0
entry start

include '%fasminc%\win32ax.inc'

section '.rdata' data readable writeable

  test1         dq -5.0
  test2         dd 5

;section '.data' readable writeable

section '.text' code readable writable executable

  start:
        ccall   _test,double [test1],test2
        invoke  ExitProcess,NULL

  proc  _test uses ebx esi edi, param1:QWORD,param2

        ret
  endp

section '.idata' import data readable writeable

  library       kernel32,'kernel32.dll',\
                user32,'user32.dll',\
                gdi32,'gdi32.dll',\
                comdlg32,'comdlg32.dll',\
                advapi32,'advapi32.dll'

  include       '%fasminc%\api\kernel32.inc'
  include       '%fasminc%\api\user32.inc'
  include       '%fasminc%\api\gdi32.inc'
  include       '%fasminc%\api\comdlg32.inc'
  include       '%fasminc%\api\advapi32.inc'
    


gives this

Code:
push    empty.00401008
push    dword ptr ds:[401004]
push    dword ptr ds:[401000]
call    empty.00402021
add     esp,0C  <--- ok, it's __cdecl
push    0
call    ExitProcess

push    ebp
mov     ebp,esp
push    ebx
push    esi
push    edi
pop     edi
pop     esi
pop     ebx
leave
retn    0C  <--- but what a hell is this?!
    
Post 11 Feb 2007, 14:49
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 11 Feb 2007, 16:51
just what you told compiler to produce. This is declaration of STDCALL proc, not declaration of C proc:
Code:
proc  _test uses ebx esi edi, param1:QWORD,param    


study this
Post 11 Feb 2007, 16:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 12 Feb 2007, 12:39
yes, i am stupid Cool you know it

ps. why macro is one simple char 'c' instead of 'cdecl'?
Post 12 Feb 2007, 12:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Feb 2007, 12:53
Quote:
ps. why macro is one simple char 'c' instead of 'cdecl'?

i agree, cdecl is better
Post 12 Feb 2007, 12:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 12 Feb 2007, 14:28
Vasilev Vjacheslav wrote:
ps. why macro is one simple char 'c' instead of 'cdecl'?

Taken from MASM's syntax.
Post 12 Feb 2007, 14:28
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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.