Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə126/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   122   123   124   125   126   127   128   129   ...   294
DelphiLanguageGuide

Calling Conventions
When you declare a procedure or function, you can specify a calling convention using one of the directives register,
pascal, cdecl, stdcall, and safecall. For example,
function MyFunction(X, Y: Real): Real; cdecl;
Calling conventions determine the order in which parameters are passed to the routine. They also affect the removal
of parameters from the stack, the use of registers for passing parameters, and error and exception handling. The
default calling convention is register.
The register and pascal conventions pass parameters from left to right; that is, the left most parameter is
evaluated and passed first and the rightmost parameter is evaluated and passed last. The cdecl, stdcall, and
safecall conventions pass parameters from right to left.
For all conventions except cdecl, the procedure or function removes parameters from the stack upon returning.
With the cdecl convention, the caller removes parameters from the stack when the call returns.
The register convention uses up to three CPU registers to pass parameters, while the other conventions pass
all parameters on the stack.
The safecall convention implements exception 'firewalls.' On Win32, this implements interprocess COM error
notification.
The table below summarizes calling conventions.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   122   123   124   125   126   127   128   129   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin