Talk:Command line parameters and environment variables

From Lazarus wiki
Revision as of 23:34, 18 June 2020 by Kai Burghardt (talk | contribs) (paramStr(0): add new external links (spam detection false positive))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

paramStr(0)

@Kai: paramstr(0) isn't guaranteed to return the name of the program on all platforms. IIRC then only DOS/Windows (maybe OS2) guarantees it. --Bart (talk) 22:29, 17 June 2020 (CEST)

It isn’t? I tried to read the RTL’s documentation as carefully as possible. I couldn’t and can’t infer any other constraints than what I’ve already mentioned. I’ve scoured the forum now too, but I couldn’t find statements definitely corroborating your claim: It is available on all platforms, but not if the executable resides on a remote FS. There is definitely a warning though. I’ve added a note. Kai Burghardt (talk) 00:39, 18 June 2020 (CEST)
On *nix paramstr(0) is alos not guaranteed to deliver the excutable filename, though ATM it seems to work on all known systems.
In practice I haven't experience problems with it. IIRC there was a discussion on the ML about it, but that's long time ago. --Bart (talk) 12:56, 18 June 2020 (CEST)
I believe the post on the mailing list is this one by Jonas: https://lists.freepascal.org/pipermail/fpc-pascal/2009-February/020211.html Trev (talk) 14:13, 18 June 2020 (CEST)
Yes, this is the post I remembered. --Bart (talk) 16:37, 18 June 2020 (CEST)
OK… So… It’s virtually useless. Uhm… Then… Thanks for the clarification, I guess? It’s just, I’ve heard all functionality the system unit provides is supposed to work on all platforms FPC supports. I didn’t know there were unreliable functions present. This is news to me. Kai Burghardt (talk) 00:34, 19 June 2020 (CEST)