Reputation: 515
I have a procedure in Delphi Berlin which I want to convert for Linux as a console application. Below is my procedure:
StrVal is declare as Private
procedure DoGetSy();
var
s: String;
n: Integer;
HasSy: Boolean;
begin
HasSy := False;
if ch = '_' then begin
SyBegPos := ix-1;
sy := StrCharSetSy;
GetChar();
GetIdent();
Ident := '_' + Ident;
HasSy := True;
end;
if (not HasSy) and (IBServerOptions.SQLServerVersion in [st_Firebird_25, st_Firebird_30]) then begin
if (ch = '0') and ((CurCh()='x') or (CurCh()='X')) then begin
// hex literal (integer)
sy := IntValSy;
GetChar();
GetChar();
StrVal := '';
while CharInSet(ch, ['0'..'9','A'..'F','a'..'f']) do begin
StrVal := StrVal + ch;
GetChar();
end;
// (?) Int64
// IntVal := StrToInt('$' + StrVal);
IntVal := 0;
if TryStrToInt(StrVal, n) then begin
IntVal := n;
end;
HasSy := True;
end
else if ((UpCase(ch) = 'X') and (CurCh() = '''')) then begin
// hex literal (binary string)
GetChar();
sy := StrValSy;
StrQuoteCh := ch;
StrVal := GetStr();
n := Length(StrVal);
if (Odd(n)) then n := (n div 2) + 1
else n := n div 2;
StrVal := LowerCase(StrVal);
SetLength(s, n);
HexToBin(PChar(StrVal), PChar(s), n);// in Linux here compiler gives exception as There is no overloaded version of 'HexToBin' that can be called with these arguments
StrVal := s;
HasSy := True;
end;
end; // Firebird 2.5, 3.0
if not HasSy then begin
inherited;
if (sy = StrValSy) and (StrQuoteCh = '"') and
(IBServerOptions.SQLDialect = 3) and (StrVal <> '') then begin
sy := IdentSy;
Ident := StrVal;
end;
end;
end;
in Linux it's using following method:
procedure BinToHex(const Buffer: TBytes; BufOffset: Integer;
var Text: TBytes; TextOffset: Integer; Count: Integer); overload;
where as in Windows it work perfectly. How can I overcome with this?
Upvotes: 0
Views: 253
Reputation: 598424
The overloaded version of HexToBin()
that you are trying to call simply does not exist on the NEXTGEN compilers (iOS, Android, and Linux). These are the only overloads available on those compilers:
function HexToBin(const Text: PChar; TextOffset: Integer;
var Buffer: TBytes; BufOffset: Integer; Count: Integer): Integer; overload;
function HexToBin(const Text: TBytes; TextOffset: Integer;
var Buffer: TBytes; BufOffset: Integer; Count: Integer): Integer; overload;
You will have to adjust your code accordingly.
Upvotes: 2