Previous: -D__BP_UNPORTABLE_ROUTINES__ - Intr; DosVersion; etc., Up: BP Incompatibilities

7.2.19 -D__BP_PARAMSTR_0__ - BP compatible ParamStr (0) behaviour

In BP (or under Dos), ParamStr (0) always contains the full path of the current executable. Under GPC, by default it contains what was passed by the caller as the 0th argument – which is often the name of the executable, but that's merely a convention, and it usually does not include the path.

If you use the System unit (see - -uses=System - Swap; HeapError; etc.) and define the symbol __BP_PARAMSTR_0__ (by giving -D__BP_PARAMSTR_0__ on the command line), it will change the value of ParamStr (0) to that of ExecutablePath, overwriting the value actually passed by the caller, to imitate BP's/Dos's behaviour. However note: On most systems, ExecutablePath is not guaranteed to return the full path, so defining this symbol doesn't change anything. In general, you cannot expect to find the full executable path, so better don't even try it, or your program will (at best) run on some systems. For most cases where BP programs access their own executable, there are cleaner alternatives available.