我在Delphi Berlin中有一个程序,我希望将其转换为Linux作为控制台应用程序。以下是我的程序:
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;
在Linux中使用以下方法:
procedure BinToHex(const Buffer: TBytes; BufOffset: Integer;
var Text: TBytes; TextOffset: Integer; Count: Integer); overload;
在Windows中,它可以完美地工作。我怎么能克服这个?
答案 0 :(得分:2)
NEXTGEN编译器(iOS,Android和Linux)上不存在您尝试调用的HexToBin()
的重载版本。这些是这些编译器上唯一可用的重载:
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;
您必须相应地调整代码。