| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD |
| X-Spam-Check-By: | sourceware.org |
| MIME-Version: | 1.0 |
| Subject: | RE: Oracle OCI under cygwin |
| Date: | Wed, 7 Mar 2012 16:37:40 +0100 |
| Message-ID: | <6BFA9AF2C7556E42AFF3F187ECAB07B802DAF9BB@bespdc01.mediaxim.local> |
| In-Reply-To: | <20120307145527.GI5159@calimero.vinschen.de> |
| References: | <6BFA9AF2C7556E42AFF3F187ECAB07B802DAF981 AT bespdc01 DOT mediaxim DOT local> <20120307144649 DOT GH5159 AT calimero DOT vinschen DOT de> <20120307145527 DOT GI5159 AT calimero DOT vinschen DOT de> |
| From: | "Michel Bardiaux" <MBardiaux AT mediaxim DOT be> |
| To: | <cygwin AT cygwin DOT com> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id q27Fc96i010030 |
> 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?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |