2017-04-11 13 views
0

私はコンソールアプリケーションとしてLinux用に変換したいDelphi Berlinの手続きを持っています。 LinuxでのDelphi Tokyo HexToBin for 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; 

が、それは以下の方法を使用しています:

procedure BinToHex(const Buffer: TBytes; BufOffset: Integer; 
    var Text: TBytes; TextOffset: Integer; Count: Integer); overload; 

それが完璧に動作するWindowsの場合、以下のように私の手順です。どのように私はこれで克服できますか?

+1

ソース(System.Classes)を見ると、BinToHex関数とHexToBin関数は '$ IFNDEF NEXTGEN'しか使用できないことがわかります。私は間違っているかもしれませんがLinuxコンパイラはNEXTGENであるため、現在は必要ありませんので、Linuxのサポートはあまり見ていないので、これらの関数は利用できません)。 WindowsコンパイラはNEXTGENではないので、そこで関数を利用できます。 –

+0

はい、LinuxコンパイラはNEXTGENコンパイラです –

+2

関連:[Android用のDelphi FiremonkeyでHextoBinを使用する方法](http://stackoverflow.com/questions/42962063/)。 –

答えて

2

コールしようとしているHexToBin()のオーバーロードされたバージョンは、NEXTGENコンパイラ(iOS、Android、Linux)には存在しません。これらのコンパイラで使用できる唯一のオーバーロードは次のとおりです。

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; 

これに応じてコードを調整する必要があります。

関連する問題