X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 7 Mar 2012 16:47:21 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Oracle OCI under cygwin
Message-ID: <20120307154721.GJ5159@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <6BFA9AF2C7556E42AFF3F187ECAB07B802DAF981@bespdc01.mediaxim.local> <20120307144649.GH5159@calimero.vinschen.de> <20120307145527.GI5159@calimero.vinschen.de> <6BFA9AF2C7556E42AFF3F187ECAB07B802DAF9BB@bespdc01.mediaxim.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <6BFA9AF2C7556E42AFF3F187ECAB07B802DAF9BB@bespdc01.mediaxim.local>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Mar  7 16:37, Michel Bardiaux wrote:
> > Cygwin applications don't use the WIN32 environment.  Rather they have 
> > their own copy of the environment in a POSIX layout.  What happens is 
> > probably that the OCI lib calls GetEnvironmentString ("TNS_ADMIN",...) 
> > and gets nothing back, since the variable is just not in the Win32 
> > environment of the Cygwin application.
> > 
> > The workaround is to do this before calling ani OCI lib function:
> > 
> >   #include <sys/cygwin.h>
> > 
> >   cygwin_internal (CW_SYNC_WINENV);
> > 
> >  This call copies the POSIX environment over to the Win32 environment
> >  of the calling process, so the OCI lib functions should find the
> >  TNS_ADMIN variable when called *after* the above call.
> 
> This worked like a charm. Thank you.
> 
> I suppose the same should be done whenever one calls a function in a non-cygwin DLL that relies on Win32 environment variables?

If you don't modify environment variables, you only have to call it
once at the start.  Otherwise, every time you call setenv or putenv.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

