Difference between revisions of "Safecall"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed typo)
m (Fixed typos)
 
Line 1: Line 1:
{{savecall}}
+
{{safecall}}
  
  
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';
...