Difference between revisions of "Safecall"

From Free Pascal wiki
Jump to navigationJump to search
(English translation of German page)
 
m (Fixed typos)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{savecall}}
+
{{safecall}}
  
  
Line 5: Line 5:
  
  
The '''savecall''' modifier:
+
The '''safecall''' modifier:
  
 
* belongs to the calling conventions of internal and external subroutines;
 
* belongs to the calling conventions of internal and external subroutines;
Line 13: Line 13:
  
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
function subTest : string; [savecall];
+
function subTest : string; [safecall];
 
begin
 
begin
 
   subTest := 'abc';
 
   subTest := 'abc';
Line 23: Line 23:
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
 
...
 
...
function funcTest(strTestData : Pchar) : LongWord; savecall; external 'testLibrary.dylib';
+
function funcTest(strTestData : Pchar) : LongWord; safecall; external 'testLibrary.dylib';
 
...
 
...
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:54, 26 February 2020

Deutsch (de) English (en)


Back to Reserved words.


The safecall modifier:

  • belongs to the calling conventions of internal and external subroutines;
  • works like the stdcall modifier, with the difference that the register contents are saved and restored.

Example:

function subTest : string; [safecall];
begin
  subTest := 'abc';
end;

Example 2:

...
function funcTest(strTestData : Pchar) : LongWord; safecall; external 'testLibrary.dylib';
...