in reply to Re^19: Using STDIN after exec() with ActiveState Perl
in thread Using STDIN after exec() with ActiveState Perl
"plain xs" works for gettin %ENV changes reflected ; I never cared much for swig
Are you sure it's really related to xs vs swig and not Linux vs Windows? Did you test your code under Windows?
Windows manages two sets of environment definitions as soon as the CRT is started which leads to consistency problems such as the one I encountered, but it's not specific to perl (cf http://www.codeproject.com/Articles/43029/When-what-you-set-is-not-what-you-get-SetEnvironme)
Then, when my script runs under Windows, I call exportEnvVar for each environment variable I update which needs to be seen by the dynamic library. This adds yet another platform-specific code to my script but I guess it's unavoidable... On Linux I don't need to do all that but on the other hand I need to restart (exec self) when I update LD_LIBRARY_PATH to select the dynamic library.if($^O eq 'MSWin32') { require Win32::API; Win32::API->Import('msvcrt', 'int __cdecl _putenv (char* envstring)' +); } sub exportEnvVar { my $envVar=shift; my $envVarDef="$envVar=".($ENV{$envVar}//''); die "Unable to export environment variable definition \"$envVarDef\" +" unless(_putenv($envVarDef) == 0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^21: Using STDIN after exec() with ActiveState Perl
by Anonymous Monk on Jun 23, 2015 at 11:09 UTC | |
by Yaribz (Beadle) on Jun 23, 2015 at 12:31 UTC | |
by Anonymous Monk on Jun 23, 2015 at 23:08 UTC | |
by Anonymous Monk on Jun 23, 2015 at 23:58 UTC |