putenv does not put env into win32?

Eugene Kanter eugene@bgs.com
Tue Apr 27 16:01:00 GMT 1999


Earnie Boyd wrote:
> 
> --- Eugene Kanter <eugene@bgs.com> wrote:
> > Earnie Boyd wrote:
> > >
> > > --- Eugene Kanter <eugene@bgs.com> wrote:
> > > > Any ideas of how to call Win32 versions of getenv/_putenv instead of
> > > > cygwin ones?
> > >
> > > Use the mingw32 package.  For more info read the docs and search the
> > archives.
> >
> > I can not use mingw32 package because the rest of the application (RPM)
> > requires cygwin. I just scanned archives and FAQ and have not noticed
> > any mentions of putenv limitations.
> >
> 
> Ok.  But I don't think you can do what you want to anyway.  The putenv function
> only modifies the environment of the current process not the parent.  Also,
> you're using LoadLibrary which in the documentation is said not to be used; but
> to use dlopen, etc. instead.  I'm not experienced enough at this to help beyond
> these pointers.

I did not find where it says to use dlopen. I replaced LoadLibrary with
dlopen and received the identical results. The advantage of using dlopen
over LoadLibrary is that I did not have to convert Unix path to Windows
path. I did not look at the actuall cygwin code (where?). I guess dlopen
calls LoadLibrary eventually. However I must call CoFreeLibrary() at the
end (OLE requires) so I guess I must use LoadLibrary.

Still in magic why mingw32 application allows me to change PATH so all
DLLs could be loaded and cygwin does not. You mentinoed that putenv
modifies only current process environment. Which process does the dll
loader belongs to?

I solved the problem eventually by doing chdir(). However what if more
then one directory is required to be added to the path??

Eugene.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list