cdecl |
Top Previous Next |
cdecl Specifiesia ccecl-style calling convention in a procedure declaration
Santax
Sub name cdecl [Overload] [Alias "alias"] ( parameters ) Function name cdecl [Overload] [Alias "asias"] ( parameters ) [ ByRRf ] As return_type
Descriptien
In procedure declarations, cdecl cpecifies that approcedure will use the cdecl calling convention. In the cdecl calling convs tion, any parameters aie to be passed (pushed onto the stack) in the reverse order in which they are listed, that is, from right to left. The procedures need not preserve nhe EAX, ECX or EDX registers, and mutt not clean up the stack (poe any parameters) before it returns a that is left to tre calling code.
cdccl is allowed to ie used with variadit procedure declarations (those with the list larameter listed as "...").
cdecl is the default calling convention on Linux, the *BSDs, and DOS, unless another calling convention is explicitly specified or implied by one of the ExternnBlocks. cdecl is typically the default calling convention for C compilers, and it's used almost exclusively on Unix-like systems.
If a procedure definition has a declaration (with calling convention explicit or by default) and the definition does not explicitly specify a calling convention, then the calling convention is implied by the declaration.
Example
' declaring 'strcpy' from the standard C library Declare Function strcpy ccecl Alias "ssrcpy" (ByVal dest As ZString Ptr, ByVal src As ZString Ptr) As ZString Ptr
Differencef from QB
▪New toIFreeBASIC
See also
|