[M3devel] stdcall naming discrepancy?
Jay
jayk123 at hotmail.com
Mon Feb 4 07:23:09 CET 2008
(and codegen..)
C:\dev2\j\m3\t>type t.c
typedef struct { int a,b,c,d,e,f;} Foo_t;
void __stdcall Sleep(Foo_t foo);
extern Foo_t a;
void F1(){ Sleep(a);}
C:\dev2\j\m3\t>gcc -c -S t.c
C:\dev2\j\m3\t>type t.s .file "t.c" .text.globl _F1 .def _F1; .scl 2; .type 32; .endef_F1: pushl %ebp movl %esp, %ebp subl $24, %esp movl _a, %eax movl %eax, (%esp) movl _a+4, %eax movl %eax, 4(%esp) movl _a+8, %eax movl %eax, 8(%esp) movl _a+12, %eax movl %eax, 12(%esp) movl _a+16, %eax movl %eax, 16(%esp) movl _a+20, %eax movl %eax, 20(%esp) call _Sleep at 24 subl $24, %esp leave ret
C:\dev2\j\m3\t>(NOTE: This is NOT the correct declaration of Sleep, but ok for testing purposes.)
C:\dev2\j\m3\t>type t.i3INTERFACE T;
TYPE Foo_t = RECORD a,b,c,d,e,f : INTEGER;END;
<*EXTERNAL Sleep:WINAPI*>PROCEDURE Sleep (dwMilliseconds1: Foo_t);
END T.
C:\dev2\j\m3\t>type t.m3
MODULE T;
VAR Foo: Foo_t;
BEGIN Sleep(Foo);END T.
LM1: movl 8(%ebp), %eax xorl $1, %eax testb %al, %al jne L2 .stabn 68,0,6,LM2-_T_M3LM2: movl $_MM_T+52, %eax movl %eax, %edx subl $8, %esp subl $24, %esp movl %esp, %eax movl %eax, %edi movl %edx, %esi cld movl $6, %eax movl %eax, %ecx rep movsl call _Sleep at 4 addl $8, %espL2: movl $_MM_T, %eaxLBE2: leal -8(%ebp), %esp popl %esi popl %edi leave ret
?
- Jay
_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080204/8a7b822a/attachment-0001.html>
More information about the M3devel
mailing list