unit uMathLibrary;

interface

function ScottAddDoubles(a: double; b: double): double; stdCall;
function AddDouble(a: double; b: double): double; stdCall;

function AddInt(a: integer; b: integer): integer; stdCall;
function ANDER(a: boolean; b: boolean): boolean; stdCall;

function AddMultiply(a: double; b: double): double;
function Multiply(a: double; b: double): double;
procedure ReturnTwoStrings(Str1, Str2: pAnsichar); stdCall;
function Version(Str1: pAnsichar): integer; stdCall;

implementation

// function Version; external 'MathLibrary.dll' index 8;

function ScottAddDoubles(a: double; b: double): double; stdCall;
type
  TScottAddDoublesFunc = function(aa: double; bb: double): double; stdCall;
var
  ScottAddDoublesFunc: TScottAddDoublesFunc;

begin

  result := False; // preset the result to error
  dllHandle := LoadLibrary('Rotor.DLL');
  if dllHandle <> 0 then
  begin
    @ErrorMsgBoxFunc := GetProcAddress(dllHandle, 'ErrorMsgBox');
    if Assigned(ErrorMsgBoxFunc) then
      if (ErrorMsgBoxFunc(pAnsichar(AnsiString(Text))) <> 0) then
        result := True
      else
        FreeLibrary(dllHandle);
  end;
end;

function ScottAddDoubles; external 'MathLibrary.dll' index 5;
function AddDouble; external 'MathLibrary.dll' index 2;
function AddInt; external 'MathLibrary.dll' index 3;
function ANDER; external 'MathLibrary.dll' index 1;

function AddMultiply; external 'MathLibrary.dll' index 4;
function Multiply; external 'MathLibrary.dll' index 5;

procedure ReturnTwoStrings; external 'MathLibrary.dll' index 6;

end.
