Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

"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)

For the record, here is the workaround I came up with for now:
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); }
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.

In reply to Re^20: Using STDIN after exec() with ActiveState Perl by Yaribz
in thread Using STDIN after exec() with ActiveState Perl by Yaribz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2022-05-23 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?