Web lists-archives.com

Re: [Mingw-users] setenv()




Keith Marshall:

>1. MSVCRT.DLL     exports    putenv(),    (strictly
>   _putenv(), but MinGW defines an  import  library
>   alias   with   the  POSIX.1-2008-XSI  compatible
>   name), which is semantically similar to the Unix
>   System  V  function  of the same name.  However,
>   there is no setenv(), nor any semantically simi-
>   lar API, provided by any Windows DLL.
>
>2. Neither  putenv(),  nor  setenv() is required by
>   ISO-C, so, even though  both  are  specified  by
>   POSIX,  it isn't considered imperative for MinGW
>   to  provide  what  isn't  already  provided   by
>   MSVCRT.DLL.

Thanks for the explanation, Keith.

>Draw  inspiration from the attached modification to
>your original sample code, to implement setenv(),

Thanks, I will.  As I can tell, the variable buf  is
a local one, whereas according to the putenv man en-
try, "The string pointed to by string  becomes  part
of  the  environment, so altering the string changes
the environment." Does the Microsoft  implementation
copy the string passed?  They do not seem to mention
it in the reference:

   https://msdn.microsoft.com/en-us/library/83zh4e6k.aspx

>(or, if you raise a feature request  on  the  issue
>tracker,  I  may  consider  adding  it for the next
>mingwrt release).

I will do it, to simplify the writing of cross-plat-
form code.

-- 
Please, do not send replies to the list to my e-mail.


------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe