On Sun, 19 Jul 2020 08:46:14 +0200 (CEST), Michael Van Canneyt <mich...@freepascal.org> wrote:
> > >On Sun, 19 Jul 2020, Bo Berglund via fpc-pascal wrote: > >> I am porting an old application from Delphi to Lazarus and Windows to >> Linux. >> This application has a unit ExecWait, which was created to simplify >> running tool programs from the main program, so it supplies two >> procedures as: >> >> function ExecAndWait(Cmdline: string; Hide: boolean = false; MaxWait: >> DWORD = INFINITE; Prio: TExecPrio = normal): DWORD; >> function ExecStart(Cmdline: string; InheritHandle: boolean = true; >> Prio: TExecPrio = normal): DWORD; >> >> I have had no problems with this unit when moving from Delphi to FPC, >> it compiles just fine on Windows. >> >> But when I move the code to Linux (via Subversion) it throws an error >> on "Run/Quick Compile": >> >> ExecWait.pas(15,79) Error: Identifier not found "INFINITE" >> >> The line that gets the error is the declaration for ExecAndWait above. >> >> On Windows I could check where it is defined and I found it in: >> C:\Programs\Lazarus_2.0.8\fpc\3.0.4\source\rtl\win\wininc\defines.inc >> >> How do I bring in the corresponding Linux version of this? > >You can't. INFINITE is specific to Windows. > >You must get rid of the ExecAndWait. This is just the first error you will >run into, many more will follow. > >The corresponding functions exist in FPC : > >ExecuteProcess in SysUtils unit: >https://www.freepascal.org/docs-html/current/rtl/sysutils/executeprocess.html > >Various RunCommand procedures in process unit: >https://www.freepascal.org/docs-html/current/fcl/process/runcommand.html > >or use TProcess. >https://www.freepascal.org/docs-html/current/fcl/process/tprocess.html > OK, thanks. Then I will have to make a rewrite of the unit... Possibly add IFDEF:s such that the Windows version remains and I create equivalents for Linux using for example TProcess. Thankfully there are only these two functions to deal with: ExecAndWait() starts a program and waits for it to complete ExecStart() starts a program and leaves it running These are used exactly 1 time each in the full application... -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal