Free Pascal Compiler version 3.0.4 [2018/05/19] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling C:\FPC\FPC\test_delphi.pp
test_delphi.pp(47,39) Error: Call by var for arg no. 3 has to match exactly: Got
"Pointer" expected "LongWord"
test_delphi.pp(69,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Lazarus 1.8.4 FPC 3.0.4. ActiveX issue when using WMIDephiCodeCreator. Also found it in the old closed issues on a different version.
The code (WMI delphi code creator).
procedure GetWin32_ComputerSystemInfo; const WbemUser =''; WbemPassword =''; WbemComputer ='localhost'; wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : Variant; oEnum : IEnumvariant; sValue : string; begin; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword); FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_ComputerSystem','WQL',wbemFlagForwardOnly); oEnum := IUnknown(FWbemObjectSet.NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, nil) = 0 do begin sValue:= FWbemObject.Properties.Item('Model').Value; Writeln(Format('Model %s',[sValue]));// String
Writeln(''); FWbemObject:=Unassigned; end; end;
Compiler log:
Free Pascal Compiler version 3.0.4 [2018/05/19] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Win64 for x64 Compiling C:\FPC\FPC\test_delphi.pp test_delphi.pp(47,39) Error: Call by var for arg no. 3 has to match exactly: Got "Pointer" expected "LongWord" test_delphi.pp(69,4) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted