[Lazarus] SetEnv on Linux 64bit

waldo kitty wkitty42 at windstream.net
Wed Apr 4 05:37:24 CEST 2012


On 4/3/2012 17:12, Michael Van Canneyt wrote:
> On Tue, 3 Apr 2012, waldo kitty wrote:
>> On 4/3/2012 09:57, michael.vancanneyt at wisa.be wrote:
>>> That's not how it works on Unix/Linux.
>>>
>>> You must always set up environment variables before a program starts.
>>> When starting a process, the environment for that process is started and is
>>> then immutable for the duration of the process.
>>
>> ewww... so no "fancy" capabilities like we could do in the old DOS days where
>> we could change the base environment as well as cloning it with changes for
>> child processes??? if so, that's blows several of my porting projects up :? :(
>
> Not possible on Posix platforms.

so i've been hearing over the years :( but i've kept on searching for a solution :P

>>> What you can do is execute the same binary again, but with the environment
>>> variable added to the environment of the new process.
>>
>> so, like the cloning process i mention above? that would have two copies of
>> the app in memory at once, right?
>
> If you do an fpExec() without first a fpFork() you'll have only 1 copy in
> memory. fpExec replaces the current process with a new process, and a new
> environment can be specified for the new process.

that is seemingly like the clone of the initial environment plus 
modifications... yes... maybe my historical project ports are not all blown up :)





More information about the Lazarus mailing list