Page 1 of 1

[Implemented] Support for __stdcall

Posted: Mon Dec 24, 2001 3:44 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Hello again :)

PureBasic for Windows should support
the calling conventions used by Windows.
Its __stdcall:
|Argument passing order: Right to left
|Called function pops its own ARGs from the stack


Stdcall is used in .DLLs etc...
so if i have to call a DLL, i have
to re-order the stack first.

Code: Select all

> CameraPosition(CAM-Num, x, y, z)
>  PB_CameraPosition:
>  POP  dword [tempadr]  ; ReturnAddress
>  POP  dword [temp01]   ; z
>  POP  dword [temp02]   ; y
>  POP  dword [temp03]   ; x
>  PUSH dword [temp01]   ;  z
>  PUSH dword [temp02]   ;  y
>  PUSH dword [temp03]   ;  x
>  PUSH dword EAX        ;  CAM-Num
>  CALL [adr_CameraPosition]
>  JMP  [tempadr] 
If PureBasic would support __sdtcall

Code: Select all

| .DESC-File:
|  CameraPosition:sdtcall, Long, Long, Long, Long
|  None 
it would be much easier and faster:

Code: Select all

>  PB_CameraPosition:
>  POP  dword [tempadr]  ; ReturnAddress
>  CALL [adr_CameraPosition]
>  JMP  [tempadr] 

Thanks for your attention,
...Danilo
(registered PureBasic user)

Edited by - Danilo on 24 December 2001 03:49:09