(***********************************************)
(*                                             *)
(* Dynamic-link (DLL) Sample                   *)
(* Copyright (c) 1998 by TMT Development Corp. *)
(* Author: Vadim Bodrov, TMT Development Corp. *)
(*                                             *)
(* Targets:                                    *)
(*   OS/2 DLL                                  *)
(*   WIN32 DLL                                 *)
(*                                             *)
(***********************************************)

// This implements a very simple DLL with two exported functions:

library ARCs;

// The export procedure directive prepares ArcCos
// and ArcSin for exporting

uses Math;
{$ifdef __WIN32__}
function ArcCos conv arg_stdcall (X: Extended): Extended;
{$else}
function ArcCos conv arg_os2 (X: Extended): Extended;
{$endif}
begin
  Result := RadToDeg(ArcTan2(Sqrt(1 - X * X), X));
end;

{$ifdef __WIN32__}
function ArcSin conv arg_stdcall ( X: Extended): Extended;
{$else}
function ArcSin conv arg_os2 ( X: Extended): Extended;
{$endif}
begin
  Result := RadToDeg(ArcTan2(X, Sqrt(1 - X * X)));
end;

// The exports clause actually exports the two routines,
// supplying an optional ordinal number for each of them

exports
  ArcCos name 'ArcCos',        // export by name
  ArcSin index 1;              // export by index

begin
  // Do nothing
end.