Difference between revisions of "Source Examples"

From Freepascal Amiga wiki
Jump to navigation Jump to search
(Created page with "=== Source Examples === On this page Source example are going to collect (or links to it) which working on AROS freepascal ---- One example, Put a message to a named port: <...")
 
Line 3: Line 3:
 
On this page Source example are going to collect (or links to it) which working on AROS freepascal
 
On this page Source example are going to collect (or links to it) which working on AROS freepascal
 
----
 
----
 
+
* [[Call Library]] - How to call a library function
 +
* ...
 +
----
 
One example, Put a message to a named port:
 
One example, Put a message to a named port:
 
<code>
 
<code>

Revision as of 16:11, 24 August 2013

Source Examples

On this page Source example are going to collect (or links to it) which working on AROS freepascal



One example, Put a message to a named port:

function SafePutToPort(Msg: PMessage; Portname: string): Integer;
var
  Port: PMsgPort;
  PName: PChar;
begin
  Result := -1;
  PName := PChar(Portname + #0);
  Forbid();
  Port := FindPort(PName);
  if Assigned(Port) then
  begin
    PutMsg(Port, Msg);
    Result := 0;
  end;
  Permit();
end;