digitalmars.D.learn - setenv in Windows + phobos and tango
- Daniel Keep <daniel.keep.lists gmail.com> Mar 06 2007
- tomD <t_demmer spam.web.de> Mar 06 2007
- Derek Parnell <derek psych.ward> Mar 06 2007
- Kirk McDonald <kirklin.mcdonald gmail.com> Mar 06 2007
- Mike Parker <aldacron71 yahoo.com> Mar 06 2007
- tomD <t_demmer spam.web.de> Mar 08 2007
Hi all. I'm currently trying to write a general forwarding program as part of my attempts to figure out how to install dmd (phobos) and dmd (tango) side-by-side. The idea is to copy this forwarding program into the same directory as, say, my tango dmd.exe and call it dmd-tango.exe. That way, whenever you use "dmd-tango", it on-calls the right "dmd". (At the moment, I have two DMD installs: \bin\dmd-phobos and \bin\dmd-tango.) Incidentally, cmd.exe can't execute shortcuts, so I can't use those and batch files seem to be causing problems with arguments. Basically, in order to make absolutely 100% "yes, really I mean it" sure the program I call looks in its' own directory for other executables, I need to put the target executable's directory on the front of the PATH environment variable. Unfortunetly, std.c.stdlib.setenv isn't supported on Windows. There's std.process.execve, which you can pass an environment to, but the problem with that is that there doesn't seem to be any way to actually *get* the complete environment so I can modify PATH and pass the rest unaltered. So, is there: A) any way to do this, or B) any other sane way to get tango and phobos to co-exist? And no, having to run a "switch" application simply doesn't cut it. Any suggestions would be welcome. -- Daniel I get a funny feeling all this could be easily avoided if only DMD didn't insist on always linking phobos.lib... -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 06 2007
Daniel Keep Wrote:There's std.process.execve, which you can pass an environment to, but the problem with that is that there doesn't seem to be any way to actually *get* the complete environment so I can modify PATH and pass the rest unaltered. So, is there: A) any way to do this, or
Yes. See my bug report #1004 in the bug list on how to do that with spawnvpe. execvpe should work along the same line.B) any other sane way to get tango and phobos to co-exist? And no, having to run a "switch" application simply doesn't cut it.
1) Put phobos.lib into P/../lib/phobos/ put tango into P/../lib/tango/ (but as phobos.lib) 2) nuke the lib line from your sc.ini 3) in dmd-phobos add LIB=" P/../lib/phobos";"% P%\..\lib";"% P%\..\mfc\lib";%LIB% to the environment and exec dmd with the whole command line 4) in dmd-tango do the same, just change the location. Should work (tm), but then again, I did not try :-) Ciao Tom
Mar 06 2007
On Wed, 07 Mar 2007 05:49:00 +1100, Daniel Keep wrote:Unfortunetly, std.c.stdlib.setenv isn't supported on Windows.
I use this (and it works) ... import std.string; alias char[] string; extern (C) { char* getenv (char *); int putenv (char *); } //------------------------------------------------------- string GetEnv(string pSymbol) //------------------------------------------------------- { return std.string.toString(getenv(std.string.toStringz(pSymbol))); } //------------------------------------------------------- void SetEnv(string pSymbol, string pValue, bool pOverwrite = true) //------------------------------------------------------- { if (pOverwrite || GetEnv(pSymbol).length == 0) putenv(std.string.toStringz(pSymbol ~ "=" ~ pValue)); } -- Derek Parnell Melbourne, Australia "Justice for David Hicks!" skype: derek.j.parnell
Mar 06 2007
Daniel Keep wrote:So, is there: A) any way to do this, or B) any other sane way to get tango and phobos to co-exist? And no, having to run a "switch" application simply doesn't cut it.
I wrote this a little while back: http://dsource.org/projects/tango/wiki/PhobosTangoCooperation -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.org
Mar 06 2007
Kirk McDonald wrote:Daniel Keep wrote:So, is there: A) any way to do this, or B) any other sane way to get tango and phobos to co-exist? And no, having to run a "switch" application simply doesn't cut it.
I wrote this a little while back: http://dsource.org/projects/tango/wiki/PhobosTangoCooperation
command prompts, but all I did was set the path to two different DMD installations. I never even considered replacing sc.ini with environment variables. Thanks for sharing!
Mar 06 2007
Kirk McDonald Wrote:Daniel Keep wrote:So, is there: A) any way to do this, or B) any other sane way to get tango and phobos to co-exist? And no, having to run a "switch" application simply doesn't cut it.
I wrote this a little while back: http://dsource.org/projects/tango/wiki/PhobosTangoCooperation -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.org
-L/SCANLIB to DFLAGS to actually make link look at $LIB. Ciao Tom
Mar 08 2007









tomD <t_demmer spam.web.de> 