[Lazarus] Lazarus does not find compiled package, why?
I have been off programming for a while and last time I was using Lazarus was on Linux a year or two ago. Meanwhile I have done some Windows app maintenance work on existing desktop applications with Lazarus and that has worked fine. Now I need to start a new project in Windows where I will use a custom package, which is available in the Lazarus 2.0.12 install directory below config\cmplaz\fpserialport where fpserialpkg is the name of the package. The unit with the implementation is named fpserialport.pas. The package is a wrapper for FPC Serial for RS232 communications. So I expected that if I enter fpserialport in the uses clause Lazarus would pick it up since it seemed to have been compiled earlier. But no joy... So I did the following: - Opened the package file via menu Package/OpenPackageFile and navigated to the lpk file - Selected "Compile" in the dialog that is shown and Lazarus recompiled the package successfully. But still it will not find my unit file... I was under the assumption that every package thus compiled would be known by Lazarus/Fpc... What can I do to make this work again? -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus does not find compiled package, why?
On Sun, Oct 30, 2022 at 4:50 PM Bo Berglund via lazarus wrote: > What can I do to make this work again? Project Inspector -> Add dependency -> select package you need? -- Bart -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus does not find compiled package, why?
On Sun, 30 Oct 2022 17:52:16 +0100, Bart via lazarus wrote: >On Sun, Oct 30, 2022 at 4:50 PM Bo Berglund via lazarus > wrote: > >> What can I do to make this work again? > >Project Inspector -> Add dependency -> select package you need? > Well, I tried that but my package did not show up in the list... Then I compiled again and this time I also clicked the button next to Compile to add the package to the project. And now it works... When I am at it: Is there a way on Windows to enumerate the existing serial ports so I can put a selector list on the form? -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus does not find compiled package, why?
October 31, 2022 at 5:12 AM, "Bo Berglund via lazarus" wrote: > > When I am at it: > Is there a way on Windows to enumerate the existing serial ports so I can put > a > selector list on the form? > You can use Powershell for that: [System.IO.Ports.SerialPort]::getportnames() cheers Samps Danish developer in Australia > -- > Bo Berglund > Developer in Sweden > > -- > ___ > lazarus mailing list > lazarus@lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus does not find compiled package, why?
Am 30.10.2022 um 19:42 schrieb Bo Berglund via lazarus When I am at it: Is there a way on Windows to enumerate the existing serial ports so I can put a selector list on the form? I have the following code in one of my projects (Windows-only). It creates a comma-separated list to assigned to a ComboBox.Items.CommaText function GetSerialPortNames: string; var reg: TRegistry; l, v: TStringList; n: integer; begin l := TStringList.Create; v := TStringList.Create; reg := TRegistry.Create; try reg.Access := KEY_READ; reg.RootKey := HKEY_LOCAL_MACHINE; reg.OpenKey('\HARDWARE\DEVICEMAP\SERIALCOMM', false); reg.GetValueNames(l); for n := 0 to l.Count - 1 do v.Add(PChar(reg.ReadString(l[n]))); Result := v.CommaText; finally reg.Free; l.Free; v.Free; end; end; -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus does not find compiled package, why?
On Mon, 31 Oct 2022 00:32:50 +0100, Werner Pamler via lazarus wrote: >Am 30.10.2022 um 19:42 schrieb Bo Berglund via lazarus >> When I am at it: >> Is there a way on Windows to enumerate the existing serial ports so I can >> put a >> selector list on the form? > >I have the following code in one of my projects (Windows-only). It >creates a comma-separated list to assigned to a ComboBox.Items.CommaText > >function GetSerialPortNames: string; >var > reg: TRegistry; > l, v: TStringList; > n: integer; >begin > l := TStringList.Create; > v := TStringList.Create; > reg := TRegistry.Create; > try > reg.Access := KEY_READ; > reg.RootKey := HKEY_LOCAL_MACHINE; > reg.OpenKey('\HARDWARE\DEVICEMAP\SERIALCOMM', false); > reg.GetValueNames(l); > for n := 0 to l.Count - 1 do > v.Add(PChar(reg.ReadString(l[n]))); > Result := v.CommaText; > finally > reg.Free; > l.Free; > v.Free; > end; >end; Thanks, I used the registry way since it was not so hard to do and this will only be a Windows app. function THanSimulatorMain.ListSerialPorts(LS: TStrings): integer; var I:integer; reg:tregistry; begin Reg := TRegistry.Create; try Reg.RootKey := HKEY_LOCAL_MACHINE; if Reg.OpenKeyReadOnly('HARDWARE\DEVICEMAP\SERIALCOMM') then begin LS.Clear; Reg.GetValueNames(LS); for I := 0 to LS.Count - 1 do LS[i] := Reg.ReadString(LS[i]); end; Result := LS.Count; finally Reg.Free; end; end; -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus