Problem with convert from Delphi to Lazarus lazarus / 67-Windows ---------------------------------------------------------------------- teco · 2024-04-04 12:17 Hi, I have used the converter from Lazarus 3.2 to convert a Delphi Sourcecode to Lazarus. The converter has finished, but when I try to compile I get a lot of errors. Is there a Namespace Reference List available. The current source of the errors are the used namespaces. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Winapi.Windows, Winapi.Messages,  System.SysUtils, System.StrUtils, System.DateUtils, System.IOUtils, System.Variants, System.Classes, System.Math, System.Win.Registry, System.Rtti,  Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.WinXCtrls, Vcl.CheckLst, Vcl.AppEvnts, Vcl.Clipbrd,  Windows.Foundation, Windows.System.WindowsProgramming, Windows.System.Power, Windows.System.Threading,  Windows.Devices.DeviceAndDriverInstallation, Windows.System.SystemServices, Windows.System.Shutdown, Windows.System.Recovery,  Windows.UI.WindowsAndMessaging, Vcl.Menus {, Windows.UI.Input.KeyboardAndMouse};  Currently is stops because of IOUtils. What can be used instead. Thank you. ---------------------------------------------------------------------- rvk · 2024-04-04 12:26 Quote from: teco on April 04, 2024, 02:17:22 pmCurrently is stops because of IOUtils. What can be used instead. With what error? System.IOUtils should exists. (at least if I add System.IOUtils to my uses clause it doesn't complain) For IOUtils you could leave the System. in front (because it does really exist). For the others you can just strip Vcl. and System. etc. (It would be useful if the converter did that, if it doesn't already.) ---------------------------------------------------------------------- teco · 2024-04-04 12:54 I am using Lazarus 2.2.6  64 Bit Delphi Project converted with "Tools - Delphi Conversion  Convert Delphi Project to Lazarus Project" Errormessages are  "Fatal: Cannot find IOUtils used by"  or "Fatal: Cannot find System.IOUtils used by" The converter has shown only that "VCL.Forms" is not existing. I have changed this to "Forms" in the lpr file. Complete source code attached. It is from the Delphi-Praxis Forum. Any idea why it does not find System.IOUtils? ---------------------------------------------------------------------- rvk · 2024-04-04 13:48 Quote from: teco on April 04, 2024, 02:54:10 pmI am using Lazarus 2.2.6  64 BitCan't help you there. That's an old version. I thought you said you were using Lazarus 3.2 Quote from: teco on April 04, 2024, 02:17:22 pmI have used the converter from Lazarus 3.2 to convert a Delphi Sourcecode to Lazarus. Quote from: teco on April 04, 2024, 02:54:10 pmAny idea why it does not find System.IOUtils? For FPC 3.2.2 (which should also be in Laz 2.2.6) it would be in fpc\packages\vcl-compat\src. I don't have a Laz 2.2.6 installed so I can't check. But if you used the converter from Lazarus 3.2, you should also use Lazarus 3.2 itself. Not go back with the converted project to 2.2.6. ---------------------------------------------------------------------- teco · 2024-04-04 13:58 Sorry for confusion. First I have used Lazarus 3.2. As it failed I have tried an old installation of Lazarus 2.2.6. The folder  fpc\packages\vcl-compat\src has only the file "system.netencoding.pp" Is the installation broken? I have only installed the 64 bit Windows version and the cross kit for 32bit ---------------------------------------------------------------------- wp · 2024-04-04 14:00 System.IOUtils seems to be something added by FPC/main, FPC 3.2.2 does not find it. teco is right: packages/vcl-compat containt only the netencoding file, but FPC/main contains mainy more, among them system.ioutils. This unit itself contains a lot of code in which various functions scattered over various units are grouped into "modern" classes (TDirectory, TPath, TFile). Comment this unit out in the uses clause of the converted project. Try to compile, and the compiler will tell you which function/procedure etc is missing now. Try to find them in the FPC files (do a "Search" > "Find In Files" for them in the FPC directory). Then you know the unit to be used instead. Or ask again here and tell us the missing functions. Maybe you are lucky, and the IOUtils unit can be removed without an effect because delphi very often adds standard units by default without needing them. ---------------------------------------------------------------------- rvk · 2024-04-04 14:05 Quote from: teco on April 04, 2024, 03:58:49 pmIs the installation broken? I have only installed the 64 bit Windows version and the cross kit for 32bit I'm not sure. I work with trunk (newest development) version. There the system.ioutils.pp is added on 21-01-2023. I don't know if and when it was added to FPC stable. But I can assure you, that's not the only problem you are going to encounter, translating that source. After you remove all the Vcl. and System. from the uses clause, you will se some additional units are missing. Like Vcl.WinXCtrls, Windows.Foundation, Windows.System.WindowsProgramming, Windows.System.Power, Windows.System.Threading, Windows.Devices.DeviceAndDriverInstallation, Windows.System.SystemServices, Windows.System.Shutdown, Windows.System.Recovery and Windows.UI.WindowsAndMessaging. Just comment out the System.IOUtils and see where it ends up. ---------------------------------------------------------------------- wp · 2024-04-04 14:27 I was not aware that you had attached the Delphi source in an earlier post. Now I loaded this code into Delphi 11.3 CE and noticed that even this version does not have all units. It's probably a Delphi 12 project, I don't know... Therefore I am very sure that FPC/main will not have all procedures/functions needed. One of those projects which cannot be converted... ---------------------------------------------------------------------- teco · 2024-04-04 14:37 Quote from: wp on April 04, 2024, 04:27:49 pmI was not aware that you had attached the Delphi source in an earlier post. Now I loaded this code into Delphi 11.3 CE and noticed that even this version does not have all units. It's probably a Delphi 12 project, I don't know... Therefore I am very sure that FPC/main will not have all procedures/functions needed. One of those projects which cannot be converted... Oh, Thank you for testing. I have seen this on Delphi Praxis and the compiled version. It has some functions to read out information from a Laptop battery. I have hoped to use this source code to get some how to's and to build my own battery analysis tool. Haven't known that it is for Delphi 12. ---------------------------------------------------------------------- rvk · 2024-04-04 14:46 Quote from: teco on April 04, 2024, 04:37:50 pmThank you for testing. I have seen this on Delphi Praxis and the compiled version. It has some functions to read out information from a Laptop battery. I have hoped to use this source code to get some how to's and to build my own battery analysis tool. Your best bet would be to check out the functions you want to use and search for them here on the forum or internet. For instance... I see that, for the battery, there is a function TDemoForm.DoIOCtrlBattery. The first call there is SetupDiGetClassDevs(@GUID_DEVCLASS_BATTERY .... Search for SetupDiGetClassDevs on this forum and the first hit is: Problem with converting Delphi Source (Battery Monitoring) https://forum.lazarus.freepascal.org/index.php/topic,64055.msg486106.h tml#msg486106 Hey, somebody was already working on that  Check out the answer (by @wp  ) and see if it get you any further. ---------------------------------------------------------------------- wp · 2024-04-04 14:51 Quote from: teco on April 04, 2024, 04:37:50 pmIt has some functions to read out information from a Laptop battery. Maybe this can help you... Or search the forum for "WMI" or similar. Quote from: teco on April 04, 2024, 04:37:50 pmHaven't known that it is for Delphi 12. Or for the "Enterprise"/"Architect" or whatever of an older version which "normal people" cannot afford... ---------------------------------------------------------------------- JuhaManninen · 2024-04-05 06:06 Quote from: teco on April 04, 2024, 03:58:49 pmFirst I have used Lazarus 3.2. As it failed I have tried an old installation of Lazarus 2.2.6. How did Lazarus 3.2 fail? Was it also about the converter or some other problem? If there is a regression and 2.2.6 works better than 3.2, it should be reported and fixed. [Edit] The Delphi converter in Lazarus is designed for old Delphi 7 style applications. Updating it to support new Delphi versions is challenging because the libraries in Delphi and FPC/Lazarus have diverged since then. The dotted namespaces should be supported though. ---------------------------------------------------------------------- teco · 2024-04-05 06:15 Nothing specific to fix. It lookl like that the Delphi Source has parts inside which are not supported by Lazarus/Free Pascal. Quote from: wp on April 04, 2024, 04:27:49 pmI was not aware that you had attached the Delphi source in an earlier post. Now I loaded this code into Delphi 11.3 CE and noticed that even this version does not have all units. It's probably a Delphi 12 project, I don't know... Therefore I am very sure that FPC/main will not have all procedures/functions needed. One of those projects which cannot be converted...