Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <37261778.E4D6F4BE@bgs.com> Date: Tue, 27 Apr 1999 16:00:56 -0400 From: Eugene Kanter X-Mailer: Mozilla 4.51 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT sourceware DOT cygnus DOT com Subject: putenv does not put env into win32? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Consider following code, where lpszModuleName is //c/test/somedll.dll which requires //c/test/anotherdll.dll to function. if(pathvar = getenv("PATH")) { char * dir = alloca(strlen(lpszModuleName)+1); char * tmppath = alloca(strlen(dir)+strlen(pathvar)+1); strcpy(dir, lpszModuleName); dir = dirname(dir); strcpy(tmppath, "PATH="); strcat(tmppath, dir); /* this line is for future automatic recognition */ strcat(tmppath, strstr(pathvar,"/") ? ":" : ";"); strcat(tmppath, pathvar); putenv(tmppath); } WinModuleName = pathFromUnixToWin(lpszModuleName); hMod = LoadLibrary(WinModuleName); The LoadLibrary fails in this case. If I compile the same code using -mno-cygwin changing putenv to _putenv (as told by msvc++ help), replacing contents of lpszModuleName with c:\test\somedll.dll and removing call to pathFromUnixToWin everything works fine. Any ideas of how to call Win32 versions of getenv/_putenv instead of cygwin ones? Eugene. -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com