To use this library with Delphi 10.2 and later, three procedures in SBUtils.pas need to be modified. I've chosen to overload them for not touching the original code.
// Addition for DX 10.2
// "Given that dynamic arrays are managed types, involving reference counting
// and associated helper function generation, casting array elements using
// the @ operator is disallowed as it leads to memory corruption. Performing a
// similar operation is still allowed using an explicit cast operation, under the
// developer responsibility."
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/What%27s_New
procedure PointerToLInt(var B : PLInt; const P : Pointer; Size : integer);
begin
PointerToLInt(B, ByteArray(P), Size);
end;
procedure LIntToPointer(B: PLInt; P: Pointer; var Size: LongInt);
begin
LIntToPointer(B, ByteArray(P), Size);
end;
procedure SBMove(Src: ByteArray; SrcOffset: Integer; Dst: Pointer; DstOffset: Integer; Size: Integer);
begin
SBMove(Src, SrcOffset, ByteArray(Dst), DstOffset, Size);
end;
And of course:
procedure PointerToLInt(var B : PLInt; const P : Pointer; Size : integer); overload;
procedure LIntToPointer(B: PLInt; P: Pointer; var Size: LongInt); overload;
procedure SBMove(Src: ByteArray; SrcOffset: Integer; Dst: Pointer; DstOffset: Integer; Size: Integer); overload;
For not having to modify the project compiler settings in every project where you use this library, I would recommend to add these three lines at the top of SecBbox.inc:
{$define SB_UNICODE_VCL}
{$define SB_NO_BYTEARRAY_CONST_ARRAYS}
{$define SB_PASCAL_STRINGS}
To use this library with Delphi 10.2 and later, three procedures in
SBUtils.pasneed to be modified. I've chosen to overload them for not touching the original code.And of course:
For not having to modify the project compiler settings in every project where you use this library, I would recommend to add these three lines at the top of
SecBbox.inc: