Oracle OCI under cygwin

Michel Bardiaux MBardiaux@mediaxim.be
Wed Mar 7 15:38:00 GMT 2012


> 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?


More information about the Cygwin mailing list