Page 1 of 1
Cannot Compile (Delphi XE)
Posted: Thu Feb 10, 2022 2:46 pm
by Vinski
Hello,
I just upgraded to Version 2 of DOCXReadWrite, but now the program won't compile.
I get an Error in the following line, which is part of the unit "AXWSynCrypto"
Code: Select all
{$ifdef USEAESNI} (cfAESNI in CpuFeatures) or {$endif}
Delphi says "Undeclared identifier cfAESNI"
and "Undeclared identifier CpuFeatures"
Did I mess up Installation?
If yes, how do I install correctly?
If no, what can I do to solve this problem?
Re: Cannot Compile (Delphi XE)
Posted: Mon Feb 14, 2022 5:24 pm
by larsa
Hello
I don't recognize that code line. Can you please show some more lines.
Re: Cannot Compile (Delphi XE)
Posted: Tue Feb 15, 2022 7:27 am
by Vinski
Code: Select all
{ we use direct Windows threads, since we don't need any exception handling
nor memory usage inside the Thread handler
-> avoid classes.TThread and system.BeginThread() use
-> application is still "officialy" mono-threaded (i.e. IsMultiThread=false),
for faster System.pas and FastMM4 (no locking)
-> code is even shorter then original one using TThread }
function ThreadWrapper(var P: TThreadParams): Integer; stdcall;
begin
SetCurrentThreadName('AES #%',[P.BlockIndex]);
with P do
AES.DoBlocks(bIn,bOut,bIn,bOut,BlockCount,Encrypt);
ExitThread(0);
result := 0; // make the compiler happy, but won't never be called
end;
procedure TAES.DoBlocksThread(var bIn, bOut: PAESBlock; Count: integer; doEncrypt: boolean);
var Thread: array[0..3] of TThreadParams; // faster than dynamic array
Handle: array[0..3] of THandle; // high(Thread) is not compiled by XE2
nThread, i, nOne: integer;
pIn, pOut: PAESBlock;
begin
if Count=0 then exit;
if {$ifdef USEPADLOCK} padlock_available or {$endif}
{$ifdef USEAESNI} (cfAESNI in CpuFeatures) or {$endif}
(SystemInfo.dwNumberOfProcessors<=1) or // (DebugHook<>0) or
(Count<((512*1024) div AESBlockSize)) then begin // not needed below 512 KB
DoBlocks(bIn,bOut,bIn,bOut,Count,doEncrypt);
exit;
end;
nThread := SystemInfo.dwNumberOfProcessors;
if nThread>length(Thread) then // a quad-core is enough ;)
nThread := length(Thread);
nOne := Count div nThread;
pIn := bIn;
pOut := bOut;
for i := 0 to nThread-1 do
with Thread[i] do begin // create threads parameters
bIn := pIn;
bOut := pOut;
BlockCount := nOne;
BlockIndex := i+1;
Encrypt := doEncrypt;
AES := self; // local copy of the AES context for every thread
Handle[i] := CreateThread(nil,0,@ThreadWrapper,@Thread[i],0,ID);
inc(pIn,nOne);
inc(pOut,nOne);
dec(Count,nOne);
end;
Re: Cannot Compile (Delphi XE)
Posted: Wed Feb 16, 2022 4:07 pm
by larsa
Hello
I have posted a new update now. Please download it.
Re: Cannot Compile (Delphi XE)
Posted: Tue Feb 22, 2022 9:07 am
by Vinski
Hello,
I installed the update, but it seems, that the Unit
has not been changed.
Hence the Problem persists and
"cfAESNI" as well as "CpuFeatures"
remain undefined.
I use Delphi XE.